You are here

public function PanelizerEntityDefault::get_substitute in Panelizer 7.3

Identifies a substitute view mode for a given bundle.

Parameters

string $view_mode: The original view mode to be checked.

string $bundle: The entity bundle being checked.

Return value

string The view mode that will be used.

Overrides PanelizerEntityInterface::get_substitute

4 calls to PanelizerEntityDefault::get_substitute()
PanelizerEntityDefault::add_bundle_setting_form in plugins/entity/PanelizerEntityDefault.class.php
Add the panelizer settings form to a single entity bundle config form.
PanelizerEntityDefault::get_view_mode in plugins/entity/PanelizerEntityDefault.class.php
Identify the view mode that will actually be used for a specific request.
PanelizerEntityDefault::render_entity in plugins/entity/PanelizerEntityDefault.class.php
Render the panels display for a given panelizer entity.
PanelizerEntityDefault::settings_form in plugins/entity/PanelizerEntityDefault.class.php
Add entity specific form to the Panelizer settings form.

File

plugins/entity/PanelizerEntityDefault.class.php, line 836
Base class for the Panelizer Entity plugin.

Class

PanelizerEntityDefault
Base class for the Panelizer Entity plugin.

Code

public function get_substitute($view_mode, $bundle) {
  $substitute = '';

  // See if a substitute should be used.
  $settings = !empty($this->plugin['bundles'][$bundle]) ? $this->plugin['bundles'][$bundle] : array(
    'status' => FALSE,
    'choice' => FALSE,
  );
  if (!empty($settings['view modes'][$view_mode]['substitute'])) {
    $substitute = $settings['view modes'][$view_mode]['substitute'];
  }
  return $substitute;
}