You are here

protected function ConfigBit::applyConfigActionAdd in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.8

Same name and namespace in other branches
  1. 9.0.x src/Config/ConfigBit.php \Drupal\varbase\Config\ConfigBit::applyConfigActionAdd()

Apply Config Action Add.

Parameters

array $config_action: The config action.

string $target_config_bit_name: The target config bit name.

\Drupal\Core\Config\Config $target_config_bit_factory: The target config object.

Return value

bool The status of the action.

1 call to ConfigBit::applyConfigActionAdd()
ConfigBit::processConfigBits in src/Config/ConfigBit.php
Process Config Bits.

File

src/Config/ConfigBit.php, line 290

Class

ConfigBit
Class ConfigBit.

Namespace

Drupal\varbase\Config

Code

protected function applyConfigActionAdd(array $config_action, string $target_config_bit_name, Config &$target_config_bit_factory) {
  if (isset($config_action['target_config_path']) && isset($config_action['target_config_value'])) {
    $target_config_data = $target_config_bit_factory
      ->get($config_action['target_config_path']);
    if (isset($target_config_data) && $this
      ->expectedTargetConfig($config_action, $target_config_data)) {
      $final_config_data = NestedArray::mergeDeep($target_config_data, $config_action['target_config_value']);
      $target_config_bit_factory
        ->set($config_action['target_config_path'], $final_config_data);
      return TRUE;
    }
  }
  return FALSE;
}