function ctools_export_ui::build_operations
Builds the operation links for a specific exportable item.
1 call to ctools_export_ui::build_operations()
- ctools_export_ui::list_form_submit in plugins/
export_ui/ ctools_export_ui.class.php - Submit the filter/sort form.
File
-
plugins/
export_ui/ ctools_export_ui.class.php, line 474
Class
- ctools_export_ui
- Base class for export UI.
Code
public function build_operations($item) {
$plugin = $this->plugin;
$schema = ctools_export_get_schema($plugin['schema']);
$operations = $plugin['allowed operations'];
$operations['import'] = FALSE;
if ($item->{$schema['export']['export type string']} == t('Normal')) {
$operations['revert'] = FALSE;
}
elseif ($item->{$schema['export']['export type string']} == t('Overridden')) {
$operations['delete'] = FALSE;
}
else {
$operations['revert'] = FALSE;
$operations['delete'] = FALSE;
}
if (empty($item->disabled)) {
$operations['enable'] = FALSE;
}
else {
$operations['disable'] = FALSE;
}
$allowed_operations = array();
foreach ($operations as $op => $info) {
if (!empty($info)) {
$allowed_operations[$op] = array(
'title' => $info['title'],
'href' => ctools_export_ui_plugin_menu_path($plugin, $op, $item->{$this->plugin['export']['key']}),
);
if (!empty($info['ajax'])) {
$allowed_operations[$op]['attributes'] = array(
'class' => array(
'use-ajax',
),
);
}
if (!empty($info['token'])) {
$allowed_operations[$op]['query'] = array(
'token' => drupal_get_token($op),
);
}
}
}
return $allowed_operations;
}