You are here

class PanelizerEntityTaxonomyTerm in Panelizer 7.3

Same name and namespace in other branches
  1. 7.2 plugins/entity/PanelizerEntityTaxonomyTerm.class.php \PanelizerEntityTaxonomyTerm

Panelizer Entity taxonomy term plugin class.

Handles term specific functionality for Panelizer.

Hierarchy

Expanded class hierarchy of PanelizerEntityTaxonomyTerm

1 string reference to 'PanelizerEntityTaxonomyTerm'
taxonomy_term.inc in plugins/entity/taxonomy_term.inc

File

plugins/entity/PanelizerEntityTaxonomyTerm.class.php, line 12
Class for the Panelizer taxonomy term entity plugin.

View source
class PanelizerEntityTaxonomyTerm extends PanelizerEntityDefault {
  public $entity_admin_root = 'admin/structure/taxonomy/%';
  public $entity_admin_bundle = 3;
  public $views_table = 'taxonomy_term_data';
  public $uses_page_manager = TRUE;
  public function init($plugin) {
    if (module_exists('taxonomy_revision')) {
      $this->supports_revisions = TRUE;
    }
    parent::init($plugin);
  }
  public function entity_access($op, $entity) {

    // This must be implemented by the extending class.
    if ($op == 'update' || $op == 'delete') {
      return taxonomy_term_edit_access($entity);
    }
    if ($op == 'view') {
      return TRUE;
    }
    return FALSE;
  }

  /**
   * Implement the save function for the entity.
   */
  public function entity_save($entity) {
    taxonomy_term_save($entity);
  }
  public function entity_identifier($entity) {
    return t('This taxonomy term');
  }
  public function entity_bundle_label() {
    return t('Taxonomy vocabulary');
  }
  function get_default_display($bundle, $view_mode) {

    // For now we just go with the empty display.
    // @todo come up with a better default display.
    return parent::get_default_display($bundle, $view_mode);
  }

  /**
   * Implements a delegated hook_page_manager_handlers().
   *
   * This makes sure that all panelized entities have the proper entry
   * in page manager for rendering.
   */
  public function hook_default_page_manager_handlers(&$handlers) {
    page_manager_get_task('term_view');
    $handler = new stdClass();
    $handler->disabled = FALSE;

    /* Edit this to true to make a default handler disabled initially */
    $handler->api_version = 1;
    $handler->name = 'term_view_panelizer';
    $handler->task = 'term_view';
    $handler->subtask = '';
    $handler->handler = 'panelizer_node';
    $handler->weight = -100;
    $handler->conf = array(
      'title' => t('Term panelizer'),
      'context' => page_manager_term_view_get_type() == 'multiple' ? 'argument_terms_1' : 'argument_term_1',
      'access' => array(),
    );
    $handlers['term_view_panelizer'] = $handler;
    return $handlers;
  }

  /**
   * Implements a delegated hook_form_alter.
   *
   * We want to add Panelizer settings for the bundle to the node type form.
   */
  public function hook_form_alter(&$form, &$form_state, $form_id) {
    if ($form_id == 'taxonomy_form_vocabulary') {
      if (isset($form['#vocabulary'])) {
        $bundle = $form['#vocabulary']->machine_name;
        $this
          ->add_bundle_setting_form($form, $form_state, $bundle, array(
          'machine_name',
        ));
      }
    }
  }

  /**
   * Fetch the entity out of a build for hook_entity_view.
   *
   * @param $build
   *   The render array that contains the entity.
   */
  public function get_entity_view_entity($build) {
    $element = '#term';
    if (isset($build[$element])) {
      return $build[$element];
    }
  }

  /**
   * Obtain the machine name of the Page Manager task.
   *
   * The Page Manager task for the taxonomy_term entity is "term_view", and not
   * the expected "taxonomy_term_view".
   */
  public function get_page_manager_task_name() {
    if (empty($this->plugin['uses page manager'])) {
      return FALSE;
    }
    else {
      return 'term_view';
    }
  }

  /**
   * Identify whether page manager is enabled for this entity type.
   *
   * Need to override this as Page Manager uses a different string for taxonomy
   * terms than other entities.
   */
  public function is_page_manager_enabled() {
    return variable_get('page_manager_term_view_disabled', TRUE);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PanelizerEntityDefault::$displays private property Storage for the display defaults already loaded by the system. Used in default_display_exists().
PanelizerEntityDefault::$displays_loaded private property
PanelizerEntityDefault::$enabled_view_modes private property
PanelizerEntityDefault::$entity_type public property The entity type the plugin is for. This is from the $plugin array.
PanelizerEntityDefault::$plugin public property The plugin metadata.
PanelizerEntityDefault::$supports_revisions public property True if the entity supports revisions. 1
PanelizerEntityDefault::access_admin function
PanelizerEntityDefault::access_default_panelizer_object public function Determine if the current user has access to the $panelizer. Overrides PanelizerEntityInterface::access_default_panelizer_object
PanelizerEntityDefault::add_admin_links public function Helper function to add administrative menu items into an entity's already existing structure.
PanelizerEntityDefault::add_bundle_setting_form public function Add the panelizer settings form to a single entity bundle config form.
PanelizerEntityDefault::add_bundle_setting_form_submit public function Submit callback for the bundle edit form.
PanelizerEntityDefault::add_bundle_setting_form_validate public function Validate callback for the bundle edit form. 1
PanelizerEntityDefault::admin_bundle_display_path public function Obtain the system path to an entity bundle's display settings page for a specific view mode. Overrides PanelizerEntityInterface::admin_bundle_display_path
PanelizerEntityDefault::check_page_manager_status public function Check if the necessary Page Manager display is enabled and the appropriate variant has not been disabled. Overrides PanelizerEntityInterface::check_page_manager_status
PanelizerEntityDefault::clone_panelizer public function Create a new, scrubbed version of a panelizer object.
PanelizerEntityDefault::default_display_exists public function Determine whether a specific default display object exists. Overrides PanelizerEntityInterface::default_display_exists
PanelizerEntityDefault::delete_entity_panelizer function Delete panelizers associated with the entity.
PanelizerEntityDefault::entity_allows_revisions public function Determine if the entity allows revisions. Overrides PanelizerEntityInterface::entity_allows_revisions 1
PanelizerEntityDefault::entity_base_url function Provides the base panelizer URL for an entity.
PanelizerEntityDefault::get_available_view_modes public function Identify the view modes that are available for use with this entity bundle. Overrides PanelizerEntityInterface::get_available_view_modes
PanelizerEntityDefault::get_base_contexts public function Callback to get the base context for a panelized entity Overrides PanelizerEntityInterface::get_base_contexts
PanelizerEntityDefault::get_bundle_title public function
PanelizerEntityDefault::get_contexts public function Fetch an object array of CTools contexts from panelizer information. Overrides PanelizerEntityInterface::get_contexts
PanelizerEntityDefault::get_default_display_default_name public function Determine the default name for the default object. Overrides PanelizerEntityInterface::get_default_display_default_name
PanelizerEntityDefault::get_default_display_name public function Determine the default display name for a given bundle & view mode combination. Overrides PanelizerEntityInterface::get_default_display_name
PanelizerEntityDefault::get_default_display_variable_name public function Determine the variable name used to identify the default display for the given bundle/view mode combination. Overrides PanelizerEntityInterface::get_default_display_variable_name
PanelizerEntityDefault::get_default_panelizer_object public function Load the named default display for the bundle. Overrides PanelizerEntityInterface::get_default_panelizer_object
PanelizerEntityDefault::get_default_panelizer_objects public function Get the default panelizers for the given bundle.
PanelizerEntityDefault::get_enabled_view_modes public function Identify the view modes that are enabled for use with Panelizer. Overrides PanelizerEntityInterface::get_enabled_view_modes
PanelizerEntityDefault::get_internal_default_panelizer public function An internal representation of a panelizer object, used to seed when we have none and want something to get started.
PanelizerEntityDefault::get_substitute public function Identifies a substitute view mode for a given bundle. Overrides PanelizerEntityInterface::get_substitute
PanelizerEntityDefault::get_view_mode public function Identify the view mode that will actually be used for a specific request. Overrides PanelizerEntityInterface::get_view_mode
PanelizerEntityDefault::has_default_panel public function Determine if a bundle has a default display. Overrides PanelizerEntityInterface::has_default_panel
PanelizerEntityDefault::has_panel_choice public function Determine if a bundle is allowed choices. Overrides PanelizerEntityInterface::has_panel_choice
PanelizerEntityDefault::hook_admin_paths public function Implements a delegated hook_menu. Overrides PanelizerEntityInterface::hook_admin_paths 1
PanelizerEntityDefault::hook_entity_delete public function Overrides PanelizerEntityInterface::hook_entity_delete
PanelizerEntityDefault::hook_entity_insert public function Overrides PanelizerEntityInterface::hook_entity_insert
PanelizerEntityDefault::hook_entity_load public function Overrides PanelizerEntityInterface::hook_entity_load
PanelizerEntityDefault::hook_entity_update public function Overrides PanelizerEntityInterface::hook_entity_update
PanelizerEntityDefault::hook_field_attach_delete_revision public function Overrides PanelizerEntityInterface::hook_field_attach_delete_revision
PanelizerEntityDefault::hook_field_attach_form public function
PanelizerEntityDefault::hook_field_attach_submit public function
PanelizerEntityDefault::hook_menu public function Implements a delegated hook_menu. Overrides PanelizerEntityInterface::hook_menu
PanelizerEntityDefault::hook_menu_alter public function Overrides PanelizerEntityInterface::hook_menu_alter
PanelizerEntityDefault::hook_panelizer_defaults public function Implements a delegated hook_panelizer_defaults().
PanelizerEntityDefault::hook_permission public function Implements a delegated hook_permission. Overrides PanelizerEntityInterface::hook_permission
PanelizerEntityDefault::hook_views_data_alter public function Implement views support for panelizer entity types. Overrides PanelizerEntityInterface::hook_views_data_alter
PanelizerEntityDefault::is_panelized public function Determine if a bundle is panelized. Overrides PanelizerEntityInterface::is_panelized
PanelizerEntityDefault::load_default_panelizer_objects public function Get the default panels, keyed by names.
PanelizerEntityDefault::make_fake_tabs function Create some fake tabs that are attached to a page output.
PanelizerEntityDefault::page_content function
PanelizerEntityDefault::page_context function
PanelizerEntityDefault::page_layout function
PanelizerEntityDefault::page_overview function Switched page callback to give the overview page
PanelizerEntityDefault::page_reset function Switched page callback to give the settings form.
PanelizerEntityDefault::page_settings function Switched page callback to give the settings form.
PanelizerEntityDefault::panelizer_access function Determine if the user has access to the panelizer operation for this type.
PanelizerEntityDefault::preprocess_panelizer_view_mode public function Preprocess the entity view mode template. 1
PanelizerEntityDefault::render_entity function Render the panels display for a given panelizer entity. Overrides PanelizerEntityInterface::render_entity 1
PanelizerEntityDefault::reset_entity_panelizer function Reset displays so that the defaults can be used instead.
PanelizerEntityDefault::settings_form public function Add entity specific form to the Panelizer settings form. Overrides PanelizerEntityInterface::settings_form 1
PanelizerEntityDefault::settings_form_submit public function Submit entity specific settings on the Panelizer settings form. Overrides PanelizerEntityInterface::settings_form_submit
PanelizerEntityDefault::settings_form_validate public function Validate entity specific settings on the Panelizer settings form. Overrides PanelizerEntityInterface::settings_form_validate
PanelizerEntityDefault::wrap_default_panelizer_pages function Provides a wrapper for the panelizer page output.
PanelizerEntityDefault::wrap_entity_panelizer_pages function Provides a wrapper for the panelizer page output.
PanelizerEntityTaxonomyTerm::$entity_admin_bundle public property
PanelizerEntityTaxonomyTerm::$entity_admin_root public property Where in the entity admin UI we should add Panelizer tabs with bundles. Overrides PanelizerEntityDefault::$entity_admin_root
PanelizerEntityTaxonomyTerm::$uses_page_manager public property
PanelizerEntityTaxonomyTerm::$views_table public property The base table in SQL the entity uses, for views support. Overrides PanelizerEntityDefault::$views_table
PanelizerEntityTaxonomyTerm::entity_access public function Determine if the current user has $op access on the $entity. Overrides PanelizerEntityInterface::entity_access
PanelizerEntityTaxonomyTerm::entity_bundle_label public function Get the name of bundles on the entity. Overrides PanelizerEntityDefault::entity_bundle_label
PanelizerEntityTaxonomyTerm::entity_identifier public function Get the visible identifier if the identity. Overrides PanelizerEntityDefault::entity_identifier
PanelizerEntityTaxonomyTerm::entity_save public function Implement the save function for the entity. Overrides PanelizerEntityInterface::entity_save
PanelizerEntityTaxonomyTerm::get_default_display function Provide a default display for newly panelized entities. Overrides PanelizerEntityDefault::get_default_display
PanelizerEntityTaxonomyTerm::get_entity_view_entity public function Fetch the entity out of a build for hook_entity_view. Overrides PanelizerEntityDefault::get_entity_view_entity
PanelizerEntityTaxonomyTerm::get_page_manager_task_name public function Obtain the machine name of the Page Manager task. Overrides PanelizerEntityDefault::get_page_manager_task_name
PanelizerEntityTaxonomyTerm::hook_default_page_manager_handlers public function Implements a delegated hook_page_manager_handlers().
PanelizerEntityTaxonomyTerm::hook_form_alter public function Implements a delegated hook_form_alter. Overrides PanelizerEntityDefault::hook_form_alter
PanelizerEntityTaxonomyTerm::init public function Initialize the plugin and store the plugin info. Overrides PanelizerEntityDefault::init
PanelizerEntityTaxonomyTerm::is_page_manager_enabled public function Identify whether page manager is enabled for this entity type. Overrides PanelizerEntityDefault::is_page_manager_enabled