You are here

public function EntityExtender::getGeneralExtraFields in Rabbit Hole 8

Same name and namespace in other branches
  1. 2.x src/EntityExtender.php \Drupal\rabbit_hole\EntityExtender::getGeneralExtraFields()

Get the extra fields that should be applied to all rabbit hole entities.

Overrides EntityExtenderInterface::getGeneralExtraFields

1 call to EntityExtender::getGeneralExtraFields()
EntityExtender::getRabbitHoleFields in src/EntityExtender.php
Return fields added by rabbit hole for use in entity_base_field_info hooks.

File

src/EntityExtender.php, line 58

Class

EntityExtender
Adds Rabbit Hole fields to supported entity types.

Namespace

Drupal\rabbit_hole

Code

public function getGeneralExtraFields() {
  $fields = [];
  $fields['rh_action'] = BaseFieldDefinition::create('string')
    ->setName('rh_action')
    ->setLabel($this
    ->t('Rabbit Hole action'))
    ->setDescription($this
    ->t('Specifies which action that Rabbit Hole should take.'));
  foreach ($this->rhBehaviorPluginManager
    ->getDefinitions() as $id => $def) {
    $this->rhBehaviorPluginManager
      ->createInstance($id)
      ->alterExtraFields($fields);
  }
  return $fields;
}