You are here

public function DomainConfigUITrait::addPath in Domain Access 8

Adds a path to the registry.

Parameters

string $new_path: The path to add.

Return value

string The normalized path that was added.

1 call to DomainConfigUITrait::addPath()
DomainConfigUIController::ajaxOperation in domain_config_ui/src/Controller/DomainConfigUIController.php
Handles AJAX operations to add/remove configuration forms.

File

domain_config_ui/src/DomainConfigUITrait.php, line 22

Class

DomainConfigUITrait
Contains helper classes for the user interface.

Namespace

Drupal\domain_config_ui

Code

public function addPath($new_path) {
  $config = \Drupal::configFactory()
    ->getEditable('domain_config_ui.settings');
  $path_string = $config
    ->get('path_pages');
  $path_array = $this
    ->explodePathSettings($path_string);
  $path_array[] = $new_path;
  $path_string = $this
    ->implodePathSettings($path_array);
  $config
    ->set('path_pages', $path_string)
    ->save();
  return $path_string;
}