You are here

public function PanelizerEntityDefault::default_display_exists in Panelizer 7.3

Determine whether a specific default display object exists.

Overrides PanelizerEntityInterface::default_display_exists

1 call to PanelizerEntityDefault::default_display_exists()
PanelizerEntityDefault::has_default_panel in plugins/entity/PanelizerEntityDefault.class.php
Determine if a bundle has a default display.

File

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

Class

PanelizerEntityDefault
Base class for the Panelizer Entity plugin.

Code

public function default_display_exists($display_name) {

  // If the display name is empty then the display doesn't exist.
  if (empty($display_name)) {
    return FALSE;
  }
  $parts = explode(':', $display_name);

  // If the display name doesn't contain the entity_type, the bundle and the
  // display machine name, then it's an invalid name.
  if (count($parts) <= 2) {
    return FALSE;
  }

  // The entity bundle is the second part of the $display_name string.
  $bundle = $parts[1];

  // If no check was performed already to see if displays exist for this
  // bundle, try loading them.
  if (empty($this->displays_loaded[$bundle])) {
    $this->displays_loaded[$bundle] = TRUE;
    $displays = $this
      ->get_default_panelizer_objects($bundle);
    $this->displays = array_merge($this->displays, $displays);
  }
  return isset($this->displays[$display_name]);
}