You are here

protected function WebformElementBase::getElementInfoDefaultProperty in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElementBase.php \Drupal\webform\Plugin\WebformElementBase::getElementInfoDefaultProperty()

Get a render element's default property.

Parameters

array $element: A render element.

string $property_name: An element's property name.

Return value

mixed A render element's default value, or NULL if property does not exist.

1 call to WebformElementBase::getElementInfoDefaultProperty()
WebformElementBase::setElementDefaultCallback in src/Plugin/WebformElementBase.php
Set element's default callback.

File

src/Plugin/WebformElementBase.php, line 399

Class

WebformElementBase
Provides a base class for a webform element.

Namespace

Drupal\webform\Plugin

Code

protected function getElementInfoDefaultProperty(array $element, $property_name) {
  if (!isset($element['#type'])) {
    return NULL;
  }
  $property_name = $property_name[0] !== '#' ? '#' . $property_name : $property_name;
  $type = $element['#type'];
  return $this->elementInfo
    ->getInfoProperty($type, $property_name, NULL) ?: $this->elementInfo
    ->getInfoProperty("webform_{$type}", $property_name, NULL);
}