public function pm_handler_area_addcontent::render in Drupal PM (Project Management) 7.3
Same name and namespace in other branches
- 8 includes/views/pm_handler_area_addcontent.inc \pm_handler_area_addcontent::render()
- 7.2 includes/views/pm_handler_area_addcontent.inc \pm_handler_area_addcontent::render()
Render the area.
Overrides views_handler_area::render
File
- includes/
views/ pm_handler_area_addcontent.inc, line 49 - Area handler for PM add content link.
Class
- pm_handler_area_addcontent
- Area handler for PM add content link.
Code
public function render($empty = FALSE) {
// Only show a link if the user has permissions for the destination.
if (node_access('create', $this->options['node_type']) === TRUE) {
$node_type_name = node_type_get_name($this->options['node_type']);
module_load_include('inc', 'pm', 'includes/pm.icon');
$link_icon = pm_icon('application_add', '');
$link_text = t('Add @node_type_name', array(
'@node_type_name' => $node_type_name,
));
$link_path = 'node/add/' . $this->options['node_type'];
$link_options = array(
'html' => TRUE,
'attributes' => array(
'class' => array(
'btn',
'btn-xs',
'btn-success',
),
),
);
if ($this->options['redirect'] == TRUE) {
$link_options['query'] = array(
'destination' => current_path(),
);
}
return l($link_icon . $link_text, $link_path, $link_options);
}
else {
return '';
}
}