class panelizer_handler_field_node_link in Panelizer 6
Same name and namespace in other branches
- 7 plugins/views/panelizer_handler_field_node_link.inc \panelizer_handler_field_node_link
Views field handler for rendering node links that point to panelizer tabs.
Hierarchy
- class \panelizer_handler_field_node_link extends \views_handler_field_node_link
Expanded class hierarchy of panelizer_handler_field_node_link
1 string reference to 'panelizer_handler_field_node_link'
- panelizer_views_data_alter in plugins/
views/ panelizer.views.inc - Implementation of hook_views_data_alter().
File
- plugins/
views/ panelizer_handler_field_node_link.inc, line 6
View source
class panelizer_handler_field_node_link extends views_handler_field_node_link {
/**
* Mapping of node paths (the part after node/N) to human-readable labels.
*
* This array is used both for the options_form in the select dropdown, and
* also when rendering the link to define the link text if not overridden.
*/
protected $tab_map = array();
function construct() {
parent::construct();
$this->tab_map = array(
'panelizer' => t('Settings'),
'panelizer/context' => t('Context'),
'panelizer/layout' => t('Layout'),
'panelizer/content' => t('Content'),
);
}
function option_definition() {
$options = parent::option_definition();
$options['panelizer_tab'] = array(
'default' => 'panelizer',
);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['panelizer_tab'] = array(
'#type' => 'select',
'#title' => 'Panelizer tab to link to',
'#options' => $this->tab_map,
'#default_value' => $this->options['panelizer_tab'],
);
}
function render_link($data, $values) {
$this->options['alter']['make_link'] = TRUE;
$tab_path = $this->options['panelizer_tab'];
$path = 'node/' . $data . '/' . $tab_path;
$this->options['alter']['path'] = $path;
$this->options['alter']['query'] = drupal_get_destination();
$text = !empty($this->options['text']) ? $this->options['text'] : $this->tab_map[$tab_path];
return $text;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
panelizer_handler_field_node_link:: |
protected | property | Mapping of node paths (the part after node/N) to human-readable labels. | |
panelizer_handler_field_node_link:: |
function | |||
panelizer_handler_field_node_link:: |
function | |||
panelizer_handler_field_node_link:: |
function | |||
panelizer_handler_field_node_link:: |
function |