You are here

public function ConfigPagesStorage::load in Config Pages 8.2

Same name and namespace in other branches
  1. 8.3 src/ConfigPagesStorage.php \Drupal\config_pages\ConfigPagesStorage::load()

Loads one entity.

Parameters

mixed $id: The ID of the entity to load.

Return value

\Drupal\Core\Entity\EntityInterface|null An entity object. NULL if no matching entity is found.

Overrides EntityStorageBase::load

1 call to ConfigPagesStorage::load()
ConfigPagesStorage::loadMultiple in src/ConfigPagesStorage.php
Loads one or more entities.

File

src/ConfigPagesStorage.php, line 19

Class

ConfigPagesStorage
Defines the storage handler class for ConfigPages.

Namespace

Drupal\config_pages

Code

public function load($id) {
  $entity = NULL;

  // Default behavior allow to load entity by ID.
  if (is_numeric($id)) {
    $entities = parent::loadMultiple([
      $id,
    ]);
    $entity = isset($entities[$id]) ? $entities[$id] : NULL;
  }
  else {

    // If config page type name given try to load it.
    $entity = ConfigPages::config($id);
  }
  return $entity;
}