You are here

public function BehaviorInvoker::getRabbitHoleValuesForEntityType in Rabbit Hole 8

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

An entity type's rabbit hole config, or the default if it does not exist.

Return an entity types's rabbit hole configuration or, failing that, the base default configuration.

Return value

array|false An array of values from the entity's fields matching the base properties added by rabbit hole. Explicit false if no matching configuration was found.

Overrides BehaviorInvokerInterface::getRabbitHoleValuesForEntityType

File

src/BehaviorInvoker.php, line 230

Class

BehaviorInvoker
Default implementation of Rabbit Hole behaviors invoker.

Namespace

Drupal\rabbit_hole

Code

public function getRabbitHoleValuesForEntityType($entity_type_id, $bundle_id = NULL) {
  $field_keys = array_keys($this->rhEntityExtender
    ->getGeneralExtraFields());
  $values = [];
  $config = $this->rhBehaviorSettingsManager
    ->loadBehaviorSettingsAsConfig($entity_type_id, $bundle_id);
  foreach ($field_keys as $field_key) {
    $config_field_key = substr($field_key, 3);
    $values[$field_key] = $config
      ->get($config_field_key);
  }
  return $values;
}