root / drupal7 / sites / all / modules / panelizer / plugins / entity / PanelizerEntityComment.class.php @ 6ae446a4
1 |
<?php
|
---|---|
2 |
/**
|
3 |
* @file
|
4 |
* Class for the Panelizer comment entity plugin.
|
5 |
*/
|
6 |
|
7 |
/**
|
8 |
* Panelizer Entity comment plugin class.
|
9 |
*
|
10 |
* Handles comment specific functionality for Panelizer.
|
11 |
*/
|
12 |
class PanelizerEntityComment extends PanelizerEntityDefault { |
13 |
public $views_table = 'comment'; |
14 |
public $uses_page_manager = FALSE; |
15 |
|
16 |
public function entity_access($op, $entity) { |
17 |
if ($op == 'edit') { |
18 |
return comment_access($op, $entity); |
19 |
} |
20 |
|
21 |
// The view operation is not implemented by core.
|
22 |
if ($op == 'view') { |
23 |
return TRUE; |
24 |
} |
25 |
|
26 |
return FALSE; |
27 |
} |
28 |
|
29 |
/**
|
30 |
* Implement the save function for the entity.
|
31 |
*/
|
32 |
public function entity_save($entity) { |
33 |
comment_save($entity);
|
34 |
} |
35 |
|
36 |
public function settings_form(&$form, &$form_state) { |
37 |
parent::settings_form($form, $form_state); |
38 |
} |
39 |
|
40 |
public function entity_identifier($entity) { |
41 |
return t('This comment'); |
42 |
} |
43 |
|
44 |
public function entity_bundle_label() { |
45 |
return t('Comment node type'); |
46 |
} |
47 |
|
48 |
function get_default_display($bundle, $view_mode) { |
49 |
// For now we just go with the empty display.
|
50 |
// @todo come up with a better default display.
|
51 |
return parent::get_default_display($bundle, $view_mode); |
52 |
} |
53 |
|
54 |
/**
|
55 |
* Implements a delegated hook_page_manager_handlers().
|
56 |
*
|
57 |
* This makes sure that all panelized entities have the proper entry
|
58 |
* in page manager for rendering.
|
59 |
*/
|
60 |
public function hook_default_page_manager_handlers(&$handlers) { |
61 |
$handler = new stdClass; |
62 |
$handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
63 |
$handler->api_version = 1; |
64 |
$handler->name = 'comment_view_panelizer'; |
65 |
$handler->task = 'comment_view'; |
66 |
$handler->subtask = ''; |
67 |
$handler->handler = 'panelizer_node'; |
68 |
$handler->weight = -100; |
69 |
$handler->conf = array( |
70 |
'title' => t('Comment panelizer'), |
71 |
'context' => 'argument_entity_id:comment_1', |
72 |
'access' => array(), |
73 |
); |
74 |
$handlers['comment_view_panelizer'] = $handler; |
75 |
|
76 |
return $handlers; |
77 |
} |
78 |
} |