You are here

public function BehaviorSettingsManager::loadBehaviorSettingsAsConfig in Rabbit Hole 2.x

Same name and namespace in other branches
  1. 8 src/BehaviorSettingsManager.php \Drupal\rabbit_hole\BehaviorSettingsManager::loadBehaviorSettingsAsConfig()

Load behaviour settings for an entity or bundle, or load the defaults.

Load rabbit hole behaviour settings appropriate to the given config or default settings if not available.

Parameters

string $entity_type_label: The entity type (e.g. node) as a string.

string $entity_id: The entity ID as a string.

Return value

\Drupal\Core\Config\ImmutableConfig The BehaviorSettings Config object.

Overrides BehaviorSettingsManagerInterface::loadBehaviorSettingsAsConfig

File

src/BehaviorSettingsManager.php, line 52

Class

BehaviorSettingsManager
Provides operations for bundles configuration.

Namespace

Drupal\rabbit_hole

Code

public function loadBehaviorSettingsAsConfig($entity_type_id, $entity_id = NULL) {
  $actual = $this->configFactory
    ->get('rabbit_hole.behavior_settings.' . $this
    ->generateBehaviorSettingsFullId($entity_type_id, $entity_id));
  if (!$actual
    ->isNew()) {
    return $actual;
  }
  else {
    return $this->configFactory
      ->get('rabbit_hole.behavior_settings.default');
  }
}