You are here

class fieldable_panels_pane in Fieldable Panels Panes (FPP) 7

Fieldable Panels Panes type Export UI plugin class.

Hierarchy

Expanded class hierarchy of fieldable_panels_pane

66 string references to 'fieldable_panels_pane'
DrupalFieldablePanelsPanesMigration::__construct in includes/fieldable_panels_pane.migrate.inc
Required arguments:
EntityTranslationFieldablePanelsPaneHandler::__construct in includes/translation.handler.fieldable_panels_pane.inc
Initializes an instance of the translation handler.
FieldablePanelsPaneInlineEntityFormController::entityForm in includes/FieldablePanelsPaneInlineEntityFormController.class.php
Returns the entity form to be shown through the IEF widget.
fieldable_panels_pane::delete_form_submit in plugins/export_ui/fieldable_panels_pane.class.php
Deletes exportable items from the database.
fieldable_panels_pane::field_admin_path in plugins/export_ui/fieldable_panels_pane.class.php
Helper method to derive paths to field UI operations.

... See full list

File

plugins/export_ui/fieldable_panels_pane.class.php, line 11
Class for Export UI to manage Fieldable Panels Pane bundles.

View source
class fieldable_panels_pane extends ctools_export_ui {

  /**
   * Add some additional operations for handling entities.
   */
  public function build_operations($item) {
    $base_path = ctools_export_ui_plugin_base_path($this->plugin);
    $name = $item->{$this->plugin['export']['key']};
    if (user_access('administer fieldable panels panes') || user_access('access fieldable panels panes master list')) {
      $operations['list'] = array(
        'title' => t('List'),
        'href' => $base_path . '/' . $name . '/list',
      );
    }
    if (user_access('administer fieldable panels panes') || user_access('create fieldable ' . $name)) {
      $operations['add_entity'] = array(
        'title' => t('Add Entity'),
        'href' => $base_path . '/' . $name . '/add',
      );
    }
    if (user_access('administer fieldable panels panes')) {
      $operations['edit_entity'] = array(
        'title' => t('Edit'),
        'href' => $base_path . '/' . $name . '/edit',
      );
      $operations['delete_entity'] = array(
        'title' => t('Delete'),
        'href' => $base_path . '/' . $name . '/delete',
      );
      $operations['export_entity'] = array(
        'title' => t('Export'),
        'href' => $base_path . '/' . $name . '/export',
      );
      if (module_exists('field_ui')) {
        $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;
  }

  /**
   * {@inheritdoc}
   */
  public function edit_form(&$form, &$form_state) {
    parent::edit_form($form, $form_state);

    // Allow users to jump right into adding fields.
    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',
      );
    }
  }

  /**
   * {@inheritdoc}
   */
  public function edit_form_submit(&$form, &$form_state) {
    parent::edit_form_submit($form, $form_state);

    // Update the form state "op" so we can properly redirect.
    if ($form_state['triggering_element']['#parents'][0] == 'save_continue') {
      $form_state['op'] = 'save_continue';
    }
  }

  /**
   * {@inheritdoc}
   */
  public function edit_save_form($form_state) {
    parent::edit_save_form($form_state);

    // Ensure menu gets rebuild after saving a new type.
    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');
    }
  }

  /**
   * {@inheritdoc}
   */
  public function delete_form_submit(&$form_state) {
    parent::delete_form_submit($form_state);

    // Remove fields associated to bundles that are being deleted.
    if ($form_state['op'] == 'delete') {
      field_attach_delete_bundle('fieldable_panels_pane', $form_state['item']->name);
      entity_info_cache_clear();
    }
  }

  /**
   * List entities page.
   */
  public 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.
   */
  public function add_entity_page($js, $input, $item, $step = NULL) {
    $args = func_get_args();
    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' => $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.
   */
  public function list_footer($form_state) {
    ctools_include('export');
    $items = ctools_export_crud_load_all('fieldable_panels_pane_type');
    $entity_info = entity_get_info('fieldable_panels_pane');
    $header = array(
      t('Name'),
      array(
        'data' => t('Operations'),
        'colspan' => 2,
      ),
    );
    $rows = array();
    if (!empty($entity_info['bundles'])) {
      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 .= ' <small>' . t('(Machine name: @type)', array(
          '@type' => $bundle,
        )) . '</small>';
        $row[] = $label;
        $operations = array();
        if (user_access('administer fieldable panels panes') || user_access('access fieldable panels panes master list')) {
          $operations['list'] = array(
            'title' => t('list'),
            'href' => 'admin/structure/fieldable-panels-panes/' . $bundle,
          );
        }
        if (user_access('administer fieldable panels panes')) {
          $operations['add'] = array(
            'title' => t('add'),
            'href' => 'admin/structure/fieldable-panels-panes/' . $bundle . '/add',
          );
          $operations['edit'] = array(
            'title' => t('edit'),
            'href' => 'admin/structure/fieldable-panels-panes/' . $bundle . '/edit',
          );
          $operations['delete'] = array(
            'title' => t('delete'),
            'href' => 'admin/structure/fieldable-panels-panes/' . $bundle . '/delete',
          );
          $operations['export'] = array(
            'title' => t('export'),
            'href' => 'admin/structure/fieldable-panels-panes/' . $bundle . '/export',
          );
          if (module_exists('field_ui')) {
            $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.
   */
  public function field_admin_path($name, $op) {
    return _field_ui_bundle_admin_path('fieldable_panels_pane', $name) . '/' . $op;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ctools_export_ui::$name property
ctools_export_ui::$options property
ctools_export_ui::$plugin property
ctools_export_ui::access public function Menu callback to determine if an operation is accessible. 1
ctools_export_ui::add_page public function
ctools_export_ui::clone_page public function Main entry point to clone an item.
ctools_export_ui::delete_page public function Page callback to delete an exportable item.
ctools_export_ui::disable_page public function Callback to disable a page.
ctools_export_ui::edit_cache_clear public function Clear the object cache for the currently edited item.
ctools_export_ui::edit_cache_get public function Retrieve the item currently being edited from the object cache.
ctools_export_ui::edit_cache_get_key public function Figure out what the cache key is for this object.
ctools_export_ui::edit_cache_set public function Cache the item currently currently being edited.
ctools_export_ui::edit_cache_set_key public function
ctools_export_ui::edit_execute_form public function Execute the form.
ctools_export_ui::edit_execute_form_standard public function Execute the standard form for editing.
ctools_export_ui::edit_execute_form_wizard public function Execute the wizard for editing.
ctools_export_ui::edit_finish_validate public function Perform a final validation check before allowing the form to be finished.
ctools_export_ui::edit_form_import public function Import form. Provides simple helptext instructions and textarea for pasting a export definition.
ctools_export_ui::edit_form_import_submit public function Submit callback for import form.
ctools_export_ui::edit_form_import_validate public function Import form validate handler.
ctools_export_ui::edit_form_validate public function Validate callback for the edit form.
ctools_export_ui::edit_page public function Main entry point to edit an item.
ctools_export_ui::edit_wizard_back public function Wizard 'back' callback when using a wizard to edit an item.
ctools_export_ui::edit_wizard_cancel public function Wizard 'cancel' callback when using a wizard to edit an item.
ctools_export_ui::edit_wizard_finish public function Wizard 'cancel' callback when using a wizard to edit an item. 1
ctools_export_ui::edit_wizard_next public function Wizard 'next' callback when using a wizard to edit an item. 1
ctools_export_ui::enable_page public function Callback to enable a page.
ctools_export_ui::export_page public function Page callback to display export information for an exportable item.
ctools_export_ui::get_page_title public function Get a page title for the current page from our plugin strings.
ctools_export_ui::get_wizard_info public function Get the form info for the wizard. 1
ctools_export_ui::hook_menu public function hook_menu() entry point.
ctools_export_ui::import_page public function Page callback to import information for an exportable item.
ctools_export_ui::init public function Fake constructor -- this is easier to deal with than the real constructor because we are retaining PHP4 compatibility, which would require all child classes to implement their own constructor. 1
ctools_export_ui::list_build_row public function Build a row based on the item. 2
ctools_export_ui::list_css public function Add listing CSS to the page.
ctools_export_ui::list_filter public function Determine if a row should be filtered out. 2
ctools_export_ui::list_form public function Create the filter/sort form at the top of a list of exports. 2
ctools_export_ui::list_form_submit public function Submit the filter/sort form.
ctools_export_ui::list_form_validate public function Validate the filter/sort form.
ctools_export_ui::list_header public function Render a header to go before the list.
ctools_export_ui::list_page public function Master entry point for handling a list.
ctools_export_ui::list_render public function Render all of the rows together.
ctools_export_ui::list_search_fields public function Provide a list of fields to test against for the default "search" widget. 1
ctools_export_ui::list_sort_options public function Provide a list of sort options. 2
ctools_export_ui::list_table_header public function Provide the table header. 2
ctools_export_ui::load_item public function Called by ctools_export_ui_load to load the item.
ctools_export_ui::redirect public function Perform a drupal_goto() to the location provided by the plugin for the operation.
ctools_export_ui::set_item_state public function Set an item's state to enabled or disabled and output to user.
fieldable_panels_pane::add_entity_page public function Add entity page.
fieldable_panels_pane::build_operations public function Add some additional operations for handling entities. Overrides ctools_export_ui::build_operations
fieldable_panels_pane::delete_form_submit public function Deletes exportable items from the database. Overrides ctools_export_ui::delete_form_submit
fieldable_panels_pane::edit_form public function Provide the actual editing form. Overrides ctools_export_ui::edit_form
fieldable_panels_pane::edit_form_submit public function Handle the submission of the edit form. Overrides ctools_export_ui::edit_form_submit
fieldable_panels_pane::edit_save_form public function Called to save the final product from the edit form. Overrides ctools_export_ui::edit_save_form
fieldable_panels_pane::field_admin_path public function Helper method to derive paths to field UI operations.
fieldable_panels_pane::list_entities_page public function List entities page.
fieldable_panels_pane::list_footer public function List footer. Overrides ctools_export_ui::list_footer