You are here

protected function UIOverrideProvider::setFormElementParameter in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/src/UIOverrideProvider.php \Drupal\bibcite_entity\UIOverrideProvider::setFormElementParameter()

Set a value of attribute for field element.

Parameters

array $element: Field element array.

string $attribute: Attribute name.

mixed $value: Attribute value.

1 call to UIOverrideProvider::setFormElementParameter()
UIOverrideProvider::referenceFormFieldsOverride in modules/bibcite_entity/src/UIOverrideProvider.php
Override elements attributes based on bundle configuration.

File

modules/bibcite_entity/src/UIOverrideProvider.php, line 299

Class

UIOverrideProvider
Collection of hardcoded overrides for reference form and view.

Namespace

Drupal\bibcite_entity

Code

protected function setFormElementParameter(array &$element, $attribute, $value) {
  if (isset($element['widget']['target_id'])) {
    $element['widget']['target_id'][$attribute] = $value;
  }
  else {
    foreach (Element::children($element['widget']) as $element_value_key) {
      $element['widget'][$element_value_key]['value'][$attribute] = $value;
    }
  }
}