/** * Add some additional operations for handling entities. */ function build_operations($item) { $base_path = ctools_export_ui_plugin_base_path($this->plugin); $name = $item->{$this->plugin['export']['key']}; $operations['list'] = array('title' => t('List'), 'href' => $base_path . '/' . $name . '/list'); $operations['add_entity'] = array('title' => t('Add Entity'), 'href' => $base_path . '/' . $name . '/add'); $operations += parent::build_operations($item); $operations['field'] = array('title' => t('Manage Fields'), 'href' => $base_path . '/' . $name . '/fields'); $operations['display'] = array('title' => t('Manage Display'), 'href' => $base_path . '/' . $name . '/display'); return $operations; }
/** * Ensure that we cannot clone from the operations link list. */ public function build_operations($item) { $item->lock_id = isset($item->lock_id) ? $item->lock_id : $item->isLocked(); $allowed_operations = parent::build_operations($item); unset($allowed_operations['clone']); if ($item->lock_id) { unset($allowed_operations['run']); $allowed_operations['unlock']['href'] .= '/' . $item->lock_id; } else { unset($allowed_operations['unlock']); } if (!empty($item->hook['configure'])) { $allowed_operations['configure'] = array('title' => t('Configure'), 'href' => $item->hook['configure']); } if (!empty($item->hook['immutable'])) { unset($allowed_operations['edit']); unset($allowed_operations['disable']); unset($allowed_operations['enable']); unset($allowed_operations['export']); } if (variable_get('maintenance_mode', 0)) { unset($allowed_operations['run']); } $item->build_operations_alter($allowed_operations); $default_sort = array('logs' => -10, 'edit' => -2, 'enable' => -1, 'disable' => -1, 'run' => 0, 'unlock' => 0, 'export' => 1, 'configure' => 1); $weight = 0; $this->notoken = TRUE; foreach ($allowed_operations as $name => &$operation) { if (!$this->access($name, $item)) { unset($allowed_operations[$name]); continue; } $operation += array('sort' => array(isset($default_sort[$name]) ? $default_sort[$name] : 0), 'alias' => TRUE); $operation['sort'][] = $weight++; } unset($this->notoken); uasort($allowed_operations, '_ultimate_cron_multi_column_sort'); return $allowed_operations; }