function ElementInfoManager::getInfoProperty

Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Render/ElementInfoManager.php \Drupal\Core\Render\ElementInfoManager::getInfoProperty()
  2. 10 core/lib/Drupal/Core/Render/ElementInfoManager.php \Drupal\Core\Render\ElementInfoManager::getInfoProperty()
  3. 11.x core/lib/Drupal/Core/Render/ElementInfoManager.php \Drupal\Core\Render\ElementInfoManager::getInfoProperty()

Retrieves a single property for the defined element type.

Parameters

string $type: An element type as defined by an element plugin.

string $property_name: The property within the element type that should be returned.

$default: (Optional) The value to return if the element type does not specify a value for the property. Defaults to NULL.

Return value

mixed The property value of the defined element type. Or the provided default value, which can be NULL.

Overrides ElementInfoManagerInterface::getInfoProperty

File

core/lib/Drupal/Core/Render/ElementInfoManager.php, line 87

Class

ElementInfoManager
Provides a plugin manager for element plugins.

Namespace

Drupal\Core\Render

Code

public function getInfoProperty($type, $property_name, $default = NULL) {
    $info = $this->getInfo($type);
    return $info[$property_name] ?? $default;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.