function commerce_backoffice_handler_field_node_operations::render in Commerce Backoffice 7
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field::render
File
- includes/
views/ handlers/ commerce_backoffice_handler_field_node_operations.inc, line 33
Class
- commerce_backoffice_handler_field_node_operations
- Displays the node operations in a ctools dropbutton.
Code
function render($values) {
$nid = $this
->get_value($values, 'nid');
$links = menu_contextual_links('node', 'node', array(
$nid,
));
// Add the quick-edit link which opens the megarow.
if ($this->options['add_quick_edit']) {
$quick_edit['quick-edit'] = menu_get_item('commerce_backoffice/variations/' . $nid);
if ($quick_edit['quick-edit']['access']) {
$quick_edit['quick-edit']['title'] = t('Quick edit');
$quick_edit['quick-edit']['attributes']['class'] = 'views-megarow-open';
$links = array_merge($quick_edit, $links);
}
}
// Add the destination to the links if specified.
if ($this->options['add_destination']) {
foreach ($links as $id => &$link) {
$link['query'] = drupal_get_destination();
}
}
$element = array(
'#markup' => theme('links__ctools_dropbutton', array(
'links' => $links,
'attributes' => array(
'class' => array(
'links',
'inline',
),
),
)),
);
return $element;
}