W3cubDocs

/Drupal 8

public function EntityType::hasHandlerClass

public EntityType::hasHandlerClass($handler_type, $nested = FALSE)

Determines if there is a handler for a given type.

Parameters

string $handler_type: The type of handler to check.

bool $nested: (optional) If this handler has a nested definition. Defaults to FALSE.

Return value

bool TRUE if a handler of this type exists, FALSE otherwise.

Overrides EntityTypeInterface::hasHandlerClass

File

core/lib/Drupal/Core/Entity/EntityType.php, line 460

Class

EntityType
Provides an implementation of an entity type and its metadata.

Namespace

Drupal\Core\Entity

Code

public function hasHandlerClass($handler_type, $nested = FALSE) {
  $handlers = $this->getHandlerClasses();
  if (!isset($handlers[$handler_type]) || ($nested && !isset($handlers[$handler_type][$nested]))) {
    return FALSE;
  }
  $handler = $handlers[$handler_type];
  if ($nested) {
    $handler = $handler[$nested];
  }
  return class_exists($handler);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityType.php/function/EntityType::hasHandlerClass/8.1.x