You are here

public function UIOverrideProvider::referenceDisplayFormFieldsOverride in Bibliography & Citation 2.0.x

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

Override fields attributes for reference display form.

Parameters

array $element: Element render array.

string $bundle_id: Entity bundle identifier.

File

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

Class

UIOverrideProvider
Collection of hardcoded overrides for reference form and view.

Namespace

Drupal\bibcite_entity

Code

public function referenceDisplayFormFieldsOverride(array &$element, $bundle_id) {

  /** @var \Drupal\bibcite_entity\Entity\ReferenceTypeInterface $bundle */
  if (($bundle = $this->typeStorage
    ->load($bundle_id)) && $bundle
    ->isRequiredOverride()) {
    foreach ($bundle
      ->getFields() as $field_name => $field_config) {
      if (isset($element['fields'][$field_name])) {
        if (!empty($field_config['label'])) {
          $element['fields'][$field_name]['human_name']['#plain_text'] = $field_config['label'];
        }
      }
    }
  }
}