From 858a3055c6b9ada83aba45febb2ca38d26233ae3 Mon Sep 17 00:00:00 2001 From: Helior Colorado Date: Fri, 8 Jun 2012 12:36:46 -0700 Subject: [PATCH] Added bundle management UI via Export UI. --- README.txt | 16 +- fieldable_panels_panes.install | 170 ++++++++++++++++ fieldable_panels_panes.module | 70 ++++--- includes/admin.inc | 56 ------ plugins/entity/FieldablePanelsPaneEntity.class.php | 4 +- plugins/export_ui/fieldable_panels_pane.class.php | 205 ++++++++++++++++++++ plugins/export_ui/fieldable_panels_pane.inc | 119 +++++++++++ 7 files changed, 542 insertions(+), 98 deletions(-) create mode 100644 plugins/export_ui/fieldable_panels_pane.class.php create mode 100644 plugins/export_ui/fieldable_panels_pane.inc diff --git a/README.txt b/README.txt index 655c0da..bde1913 100644 --- a/README.txt +++ b/README.txt @@ -1,7 +1,7 @@ -Fieldable Panel Panes support multiple bundles, but at this time there is no -UI to create bundles. +Fieldable Panel Panes support multiple bundles; they can be +created in admin/structure/fieldable-panels-panes/add. -Bundles can be created in a module via hook_entity_info_alter(). The code +Bundles can also be created in a module via hook_entity_info_alter(). The code will look something like this: function MYMODULE_entity_info_alter(&$entity_info) { @@ -11,18 +11,20 @@ function MYMODULE_entity_info_alter(&$entity_info) { 'pane top level' => FALSE, // set to true to make this show as a top level icon 'pane icon' => '/path/to/custom/icon/for/this/pane.png', 'admin' => array( - 'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type', + 'path' => 'admin/structure/fieldable-panels-panes/%fieldable_panels_panes_type', 'bundle argument' => 5, // Note that this has all _ replaced with - from the bundle name. - 'real path' => 'admin/structure/fieldable-panels-panes/manage/my-bundle-name', + 'real path' => 'admin/structure/fieldable-panels-panes/my-bundle-name', 'access arguments' => array('administer fieldable panels panes'), ), ); } -Fields are then added to your bundle as normal through the Manage Fields and +Fields are then added to your bundle as normal through the Manage Fields and Display Fields tabs in the UI. You can use this hook to rename or remove the default bundle but remember that doing so will break any content currently using that bundle. If you do this -be sure to also fix any content already using it. +be sure to also fix any content already using it. It is recommended that you +use the bundle management UI in admin/structure/fiedlable-panels-panes so you +don't have to maintain this yourself. diff --git a/fieldable_panels_panes.install b/fieldable_panels_panes.install index 799b35b..fa497f0 100644 --- a/fieldable_panels_panes.install +++ b/fieldable_panels_panes.install @@ -4,6 +4,112 @@ * fieldable panel panes install file */ + /** + * Implements hook_requirements(). + */ +function fieldable_panels_panes_requirements($phase) { + if ($phase != 'runtime') { + return; + } + + ctools_include('export'); + $requirements = array(); + + $hook = 'entity_info_alter'; + $items = ctools_export_crud_load_all('fieldable_panels_panes_type'); + + // Check each module that implements 'entity_info_alter' to see if they + // provide a bundle for Fieldable Panels Panes. + foreach (module_implements($hook) as $module) { + $info = array(); + $function = $module . '_' . $hook; + + $function($info); + + if (isset($info['fieldable_panels_pane']['bundles']) && is_array($info['fieldable_panels_pane']['bundles'])) { + + // For each bundle provided, we track some meta-information to provide decent reporting. + foreach ($info['fieldable_panels_pane']['bundles'] as $bundle_name => $bundle_info) { + $offenders[] = array( + 'module' => $module, + 'bundle label' => $bundle_info['label'], + 'duplicate' => isset($items[$bundle_name]), + 'obsolete path' => strpos($bundle_info['admin']['path'], 'admin/structure/panels/entity/manage') !== FALSE, + 'function' => $function, + ); + } + } + } + + if (!empty($offenders)) { + $items = array(); + foreach ($offenders as $offender) { + $string = array(); + $replacements = array( + '%module' => $offender['module'], + '%bundle' => $offender['bundle label'], + '%function' => $offender['function'] . '()', + '!add_page' => l(t('Add type page'), 'admin/structure/panels/fieldable-panels-panes/add'), + ); + $string[] = t('The module %module provides the bundle %bundle in %function.', $replacements); + + // If bundle admin paths are set in the wrong position, invalid tabs can + // render in the wrong position and cause all kinds of confusion. + if ($offender['obsolete path']) { + $string[] = t('It also contains an obsolete admin path which can throw some notices.'); + } + + // The upgrade path will handle migrating code-provided bundles into the + // database. There is no harm in having them both the alter hook and in + // the database, we're just notifying that the former doesn't need to exist + // anymore. + if ($offender['duplicate']) { + $string[] = t('It should now be safe to remove the bundle from %function.', $replacements); + } + else { + // Otherwise, if a bundle is provided in an alter hook AFTER the + // upgrade process, we recommend creating a type for it in the UI so + // that the module can handle the necessary processing and logic. + $string[] = t('It is recommended that a type be created for %bundle in the !add_page so the module can handle all the necessary processing.', $replacements); + } + + $items[] = implode(' ', $string); + } + + $requirements['fieldable_panels_panes'] = array( + 'title' => t('Fieldable Panels Panes'), + 'severity' => REQUIREMENT_WARNING, + 'value' => theme('item_list', array('items' => $items)), + 'description' => t('It is still possible to provide bundles in entity_info_alter(), however, it has limited support. Upgrading from a previous version of Fieldable Panels Panes would have updated those bundles to be managed by the bundle user interface (meaning the bundles in entity_info_alter() can safely be removed.) There is, however, no harm in having both exists, unless the bundle provided defines an obsolete path, in which case invalid menu tabs might render in the wrong places.'), + ); + } + + return $requirements; +} + +/** + * Implements hook_install(). + */ +function fieldable_panels_panes_install() { + ctools_include('export'); + + $item = ctools_export_crud_new('fieldable_panels_panes_type'); + $item->name = 'fieldable_panels_pane'; + $item->title = t('Panels Pane'); + ctools_export_crud_save('fieldable_panels_panes_type', $item); +} + + +/** + * Implements hook_uninstall(). + */ +function fieldable_panels_panes_uninstall() { + $results = db_query('SELECT name FROM {fieldable_panels_panes_type}'); + foreach ($results as $type) { + field_attach_delete_bundle('fieldable_panels_pane', $type->name); + } +} + /** * Implements hook_schema(). */ @@ -145,6 +251,38 @@ function fieldable_panels_panes_schema() { ), ); + $schema['fieldable_panels_panes_type'] = array( + 'description' => 'Entity bundle table for panel pane content.', + 'fields' => array( + 'name' => array( + 'description' => 'The machine-readable name of this type.', + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + ), + 'title' => array( + 'description' => 'The human-readable name of this type.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'translatable' => TRUE, + ), + 'description' => array( + 'description' => 'A brief description of this type.', + 'type' => 'text', + 'size' => 'big', + 'not null' => TRUE, + ), + ), + 'export' => array( + 'admin_title' => 'title', + 'admin_description' => 'description', + ), + 'primary key' => array('name'), + ); + return $schema; } @@ -184,3 +322,35 @@ function fieldable_panels_panes_update_7103(&$sandbox) { // all caches anyway. return t('Menu cache has been flushed.'); } + +/** + * Add Fieldable Panels Panes Type table. + * Save existing bundles to database. + */ +function fieldable_panels_panes_update_7104(&$sandbox) { + ctools_include('export'); + $messages = array(); + + // Add the new table for storing bundles. + $schema = drupal_get_schema('fieldable_panels_panes_type', TRUE); + db_create_table('fieldable_panels_panes_type', $schema); + $messages[] = t('Table %table_name has been added.', array('%table_name' => 'fieldable_panels_panes_type')); + + // Store possible existing bundles provided by other modules. + $bundles = array(); + $entity_info = entity_get_info('fieldable_panels_pane'); + foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) { + $bundles[] = $bundle_info['label']; + + $item = ctools_export_crud_new('fieldable_panels_panes_type'); + $item->name = $bundle_name; + $item->title = $bundle_info['label']; + ctools_export_crud_save('fieldable_panels_panes_type', $item); + } + + if (!empty($bundles)) { + $messages[] = format_plural(count($bundles), 'Added existing bundle %bundle_names to database.', 'Added existing bundles %bundle_names to database.', array('%bundle_names' => implode(', ', $bundles))); + } + + return implode('
', $messages); +} diff --git a/fieldable_panels_panes.module b/fieldable_panels_panes.module index 4da3ca5..6499939 100644 --- a/fieldable_panels_panes.module +++ b/fieldable_panels_panes.module @@ -13,6 +13,21 @@ * Implements hook_entity_info() */ function fieldable_panels_panes_entity_info() { + ctools_include('export'); + $bundles = array(); + + foreach (ctools_export_crud_load_all('fieldable_panels_panes_type') as $type) { + $bundles[$type->name] = array( + 'label' => $type->title, + 'admin' => array( + 'path' => 'admin/structure/fieldable-panels-panes/%ctools_export_ui', + 'bundle argument' => 3, + 'real path' => 'admin/structure/fieldable-panels-panes/' . $type->name, + 'access arguments' => array('administer fieldable panels panes'), + ), + ); + } + return array( 'fieldable_panels_pane' => array( 'label' => t('Fieldable panel pane'), @@ -29,20 +44,8 @@ function fieldable_panels_panes_entity_info() { 'uuid' => 'uuid', 'revision uuid' => 'vuuid', ), - 'bundles' => array( - // @todo We need to store the possible bundles and create a UI. - // to allow for more bundles. For now, hook_panels_panes_entity_info_alter - // will work. - 'fieldable_panels_pane' => array( - 'label' => t('Panels pane'), - 'admin' => array( - 'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type', - 'bundle argument' => 4, - 'real path' => 'admin/structure/fieldable-panels-panes/manage/fieldable-panels-pane', - 'access arguments' => array('administer fieldable panels panes'), - ), - ), - ), + 'bundles' => $bundles, + 'bundle keys' => array('bundle' => 'name'), 'view modes' => array( // @todo we should support view modes. 'full' => array( @@ -100,19 +103,6 @@ function fieldable_panels_panes_menu() { 'file' => 'includes/admin.inc', ); - - $items['admin/structure/fieldable-panels-panes'] = array( - 'title' => 'Fieldable Panels Panes', - 'description' => 'Manage pane content types.', - 'page callback' => 'fieldable_panels_panes_entities_page', - ) + $base; - - $items['admin/structure/fieldable-panels-panes/list'] = array( - 'title' => 'List', - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, - ) + $base; - $items['admin/structure/fieldable-panels-panes/view/%fieldable_panels_panes'] = array( 'title callback' => 'fieldable_panels_panes_entity_title', 'title arguments' => array(4), @@ -236,6 +226,7 @@ function fieldable_panels_panes_menu() { 'load arguments' => array(6), ) + $base; + // Legacy paths to support the old method of providing bundles via entity_hook_info(). $items['admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type'] = array( 'title callback' => 'fieldable_panels_panes_entities_title', 'title arguments' => array(4), @@ -310,11 +301,11 @@ function fieldable_panels_panes_theme() { * Implements hook_admin_menu_map(). */ function fieldable_panels_panes_admin_menu_map() { - $bundles = array(); + $bundle_keys = array(); $info = entity_get_info('fieldable_panels_pane'); foreach ($info['bundles'] as $bundle_name => $bundle_info) { - $bundles[] = strtr($bundle_name, '_', '-'); + $bundle_keys[] = $bundle_name; if (isset($bundle_info['admin'])) { $admin_path = $bundle_info['admin']['path']; @@ -326,20 +317,19 @@ function fieldable_panels_panes_admin_menu_map() { $map["$admin_path/fields/%field_ui_menu"]['parent'] = "$admin_path/fields"; $map["$admin_path/fields/%field_ui_menu"]['arguments'][] = array( - '%fieldable_panels_panes_type' => array($bundle_name), + '%ctools_export_ui' => array($bundle_name), '%field_ui_menu' => $fields, ); } } - $map['admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type'] = array( + $map['admin/structure/fieldable-panels-panes/%ctools_export_ui'] = array( 'parent' => 'admin/structure/fieldable-panels-panes', 'arguments' => array( - array('%fieldable_panels_panes_type' => $bundles), + array('%ctools_export_ui' => $bundle_keys), ), ); - return $map; } @@ -371,6 +361,16 @@ function fieldable_panels_panes_entities_title($type) { } /** + * Title callback for fieldable panels panes exportable items. + * + * @param $item + * A %ctools_export_ui object. + */ +function fieldable_panels_panes_type_title($item) { + return $item->title; +} + +/** * Ensure an entity can be accessed via URL. * * This requires only administrative access. @@ -402,6 +402,10 @@ function fieldable_panels_panes_entity_title($entity) { * Implements hook_ctools_plugin_directory() */ function fieldable_panels_panes_ctools_plugin_directory($owner, $plugin_type) { + if ($owner == 'ctools' && $plugin_type == 'export_ui') { + return 'plugins/' . $plugin_type; + } + if ($owner == 'ctools' && $plugin_type == 'content_types') { return 'plugins/' . $plugin_type; } diff --git a/includes/admin.inc b/includes/admin.inc index fc64b54..3fc0eef 100644 --- a/includes/admin.inc +++ b/includes/admin.inc @@ -6,62 +6,6 @@ */ /** - * List all bundles and administrative options for entity panes. - */ -function fieldable_panels_panes_entities_page() { - $entity_info = entity_get_info('fieldable_panels_pane'); - - $header = array(t('Name'), array('data' => t('Operations'), 'colspan' => 2)); - $rows = array(); - - foreach ($entity_info['bundles'] as $bundle => $info) { - $type_url_str = str_replace('_', '-', $bundle); - - $row = array(); - - $label = check_plain($info['label']); - $label .= ' ' . t('(Machine name: @type)', array('@type' => $bundle)) . ''; - - $row[] = $label; - - $operations = array(); - - $operations['list'] = array( - 'title' => t('list'), - 'href' => 'admin/structure/fieldable-panels-panes/manage/' . $type_url_str, - ); - - $operations['add'] = array( - 'title' => t('add'), - 'href' => 'admin/structure/fieldable-panels-panes/manage/' . $type_url_str . '/add', - ); - - $operations['fields'] = array( - 'title' => t('manage fields'), - 'href' => 'admin/structure/fieldable-panels-panes/manage/' . $type_url_str . '/fields', - ); - - $operations['display'] = array( - 'title' => t('manage display'), - 'href' => 'admin/structure/fieldable-panels-panes/manage/' . $type_url_str . '/display', - ); - - $ops = theme('links', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline')))); - - $row[] = $ops; - $rows[] = $row; - } - - $build['panes_table'] = array( - '#theme' => 'table', - '#header' => $header, - '#rows' => $rows, - ); - - return $build; -} - -/** * List all entities for the given type. */ function fieldable_panels_panes_entities_list_page($type) { diff --git a/plugins/entity/FieldablePanelsPaneEntity.class.php b/plugins/entity/FieldablePanelsPaneEntity.class.php index 1fc630f..8d96881 100644 --- a/plugins/entity/FieldablePanelsPaneEntity.class.php +++ b/plugins/entity/FieldablePanelsPaneEntity.class.php @@ -11,8 +11,8 @@ */ class FieldablePanelsPaneEntity extends PanelizerEntityDefault { // @todo this path is too deep to handle. -// public $entity_admin_root = 'admin/structure/fieldable-panels-panes/manage/%'; -// public $entity_admin_bundle = 5; +// public $entity_admin_root = 'admin/structure/fieldable-panels-panes/%'; +// public $entity_admin_bundle = 4; public $views_table = 'fieldable_panels_panes'; public function entity_access($op, $entity) { diff --git a/plugins/export_ui/fieldable_panels_pane.class.php b/plugins/export_ui/fieldable_panels_pane.class.php new file mode 100644 index 0000000..11a535e --- /dev/null +++ b/plugins/export_ui/fieldable_panels_pane.class.php @@ -0,0 +1,205 @@ +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; + } + + /** + * Allow users to jump right into adding fields. + */ + function edit_form(&$form, &$form_state) { + parent::edit_form($form, $form_state); + + if (module_exists('field_ui')) { + $form['buttons']['save_continue'] = array( + '#type' => 'submit', + '#value' => t('Save and add fields'), + '#access' => $form_state['op'] == 'add' || $form_state['op'] == 'clone', + ); + } + } + + /** + * Update the form state "op" so we can properly redirect. + */ + function edit_form_submit(&$form, &$form_state) { + parent::edit_form_submit($form, $form_state); + + if ($form_state['triggering_element']['#parents'][0] == 'save_continue') { + $form_state['op'] = 'save_continue'; + } + } + + /** + * Ensure menu gets rebuild after saving a new type. + */ + function edit_save_form($form_state) { + parent::edit_save_form($form_state); + + entity_info_cache_clear(); + menu_rebuild(); + + if ($form_state['op'] === 'save_continue') { + $this->plugin['redirect']['save_continue'] = $this->field_admin_path($form_state['values']['name'], 'fields'); + } + } + + /** + * Remove fields associated to bundles that are being deleted. + */ + function delete_form_submit(&$form_state) { + parent::delete_form_submit($form_state); + + if ($form_state['op'] == 'delete') { + field_attach_delete_bundle('fieldable_panels_pane', $form_state['item']->name); + entity_info_cache_clear(); + } + } + + /** + * List entities page. + */ + function list_entities_page($js, $input, $item, $step = NULL) { + drupal_set_title($this->get_page_title('list_entity', $item)); + + return views_embed_view('fieldable_pane_entities', 'default', $item->name); + } + + /** + * Add entity page. + */ + function add_entity_page($js, $input, $item, $step = NULL) { + drupal_set_title($this->get_page_title('add_entity', $item)); + + $form_state = array( + 'entity' => fieldable_panels_panes_create(array('bundle' => $item->name)), + 'add submit' => TRUE, + 'plugin' => $this->plugin, + 'object' => &$this, + 'ajax' => $js, + 'item' => $item, + 'op' => 'add_entity', + 'no_redirect' => TRUE, + 'rerender' => TRUE, + 'step' => $step, + 'function args' => func_get_args(), + ); + + // Default these to reusable. + $form_state['entity']->reusable = TRUE; + $output = drupal_build_form('fieldable_panels_panes_entity_edit_form', $form_state); + if (!empty($form_state['executed'])) { + $this->redirect($form_state['op'], $form_state['item']); + } + + return $output; + } + + /** + * List footer. + */ + function list_footer($form_state) { + ctools_include('export'); + $items = ctools_export_crud_load_all('fieldable_panels_panes_type'); + $entity_info = entity_get_info('fieldable_panels_pane'); + + $header = array(t('Name'), array('data' => t('Operations'), 'colspan' => 2)); + $rows = array(); + + foreach ($entity_info['bundles'] as $bundle => $info) { + // Filter out bundles that already exist as ctools exportable objects. + if (isset($items[$bundle])) { + continue; + } + + $row = array(); + + $label = check_plain($info['label']); + $label .= ' ' . t('(Machine name: @type)', array('@type' => $bundle)) . ''; + + $row[] = $label; + + $operations = array(); + + $operations['list'] = array( + 'title' => t('list'), + 'href' => 'admin/structure/fieldable-panels-panes/manage/' . $bundle, + ); + + $operations['add'] = array( + 'title' => t('add'), + 'href' => 'admin/structure/fieldable-panels-panes/manage/' . $bundle . '/add', + ); + + $operations['fields'] = array( + 'title' => t('manage fields'), + 'href' => $this->field_admin_path($bundle, 'fields'), + ); + + $operations['display'] = array( + 'title' => t('manage display'), + 'href' => $this->field_admin_path($bundle, 'display'), + ); + + $ops = theme('links', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline')))); + + $row[] = $ops; + $rows[] = $row; + } + + if (!empty($rows)) { + $variables = array( + 'caption' => t('Legacy bundles that are not managed by the bundle administrative UI are listed here.'), + 'header' => $header, + 'rows' => $rows, + ); + + return theme('table', $variables); + } + } + + /** + * Helper method to derive paths to field ui operations. + */ + function field_admin_path($name, $op) { + return _field_ui_bundle_admin_path('fieldable_panels_pane', $name) . '/' . $op; + } +} diff --git a/plugins/export_ui/fieldable_panels_pane.inc b/plugins/export_ui/fieldable_panels_pane.inc new file mode 100644 index 0000000..4f558c7 --- /dev/null +++ b/plugins/export_ui/fieldable_panels_pane.inc @@ -0,0 +1,119 @@ + 'fieldable_panels_pane', + 'schema' => 'fieldable_panels_panes_type', + 'access' => 'administer fieldable panels panes', + 'handler' => array('class' => 'fieldable_panels_pane'), + + 'title singular' => t('fieldable panels panes type'), + 'title singular proper' => t('Fieldable Panels Panes Type'), + 'title plural' => t('fieldable panels panes types'), + 'title plural proper' => t('Fieldable Panels Panes Types'), + ); + + $plugin['menu'] = array( + 'menu prefix' => 'admin/structure', + 'menu item' => 'fieldable-panels-panes', + 'menu title' => 'Fieldable Panels Panes', + 'menu description' => 'Create and manage fieldable panels pane types.', + ); + + $plugin['allowed operations'] = array( + 'clone' => FALSE, + ); + + $base_path = ctools_export_ui_plugin_base_path($plugin); + $prefix_count = count(explode('/', $plugin['menu']['menu prefix'])); + + $plugin['menu']['items'] = array( + 'list callback' => array('type' => MENU_NORMAL_ITEM), + 'edit callback' => array( + 'path' => '%ctools_export_ui', + 'title callback' => 'fieldable_panels_panes_type_title', + 'title arguments' => array($prefix_count + 1), + 'page arguments' => array($plugin['name'], 'list_entities', $prefix_count + 1), + 'access arguments' => array($plugin['name'], 'list_entities', $prefix_count + 1), + 'type' => MENU_NORMAL_ITEM, + ), + 'list_entities' => array( + 'path' => '%ctools_export_ui/list', + 'title' => 'List', + 'access callback' => 'ctools_export_ui_task_access', + 'access arguments' => array($plugin['name'], 'list_entities'), + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'weight' => -10, + ), + 'add_entity' => array( + 'path' => '%ctools_export_ui/add', + 'title' => 'Add entity', + 'page callback' => 'ctools_export_ui_switcher_page', + 'page arguments' => array($plugin['name'], 'add_entity', $prefix_count + 1), + 'load arguments' => array($plugin['name']), + 'access callback' => 'ctools_export_ui_task_access', + 'access arguments' => array($plugin['name'], 'add_entity'), + 'type' => MENU_LOCAL_TASK, + 'weight' => -9, + ), + 'edit' => array( + 'path' => '%ctools_export_ui/edit', + 'page arguments' => array($plugin['name'], 'edit', $prefix_count + 1), + 'access arguments' => array($plugin['name'], 'edit', $prefix_count + 1), + 'type' => MENU_LOCAL_TASK, + 'weight' => -8, + ), + 'export' => array( + 'path' => '%ctools_export_ui/export', + 'page arguments' => array($plugin['name'], 'export', $prefix_count + 1), + 'access arguments' => array($plugin['name'], 'export', $prefix_count + 1), + ), + 'revert' => array( + 'path' => '%ctools_export_ui/revert', + 'page arguments' => array($plugin['name'], 'delete', $prefix_count + 1), + 'access arguments' => array($plugin['name'], 'delete', $prefix_count + 1), + ), + 'delete' => array( + 'path' => '%ctools_export_ui/delete', + 'page arguments' => array($plugin['name'], 'delete', $prefix_count + 1), + 'access arguments' => array($plugin['name'], 'delete', $prefix_count + 1), + ), + 'enable' => array( + 'path' => '%ctools_export_ui/enable', + 'page arguments' => array($plugin['name'], 'enable', $prefix_count + 1), + 'access arguments' => array($plugin['name'], 'enable', $prefix_count + 1), + ), + 'disable' => array( + 'path' => '%ctools_export_ui/disable', + 'page arguments' => array($plugin['name'], 'disable', $prefix_count + 1), + 'access arguments' => array($plugin['name'], 'disable', $prefix_count + 1), + ), + ); + + $plugin['redirect'] = array( + 'add_entity' => $base_path . '/%ctools_export_ui', + ); + + $plugin['strings'] = array( + 'title' => array( + 'add_entity' => t('Add fieldable panels pane of type %title'), + 'list_entity' => t('List %title entities'), + ), + 'confirmation' => array( + 'save_continue' => array( + 'success' => t('%title has been created.'), + 'fail' => t('%title could not be created.'), + ), + ), + ); + + return $plugin; +} -- 1.7.7.5 (Apple Git-26)