You are here

public function DomainConfigUITrait::removePath in Domain Access 8

Removes a path from the registry.

Parameters

string $old_path: The path to remove.

Return value

string The normalized path that was removed.

1 call to DomainConfigUITrait::removePath()
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 44

Class

DomainConfigUITrait
Contains helper classes for the user interface.

Namespace

Drupal\domain_config_ui

Code

public function removePath($old_path) {
  $config = \Drupal::configFactory()
    ->getEditable('domain_config_ui.settings');
  $path_string = $config
    ->get('path_pages');
  $path_array = $this
    ->explodePathSettings($path_string);
  $list = array_flip($path_array);
  if (isset($list[$old_path])) {
    unset($list[$old_path]);
  }
  $path_array = array_flip($list);
  $path_string = $this
    ->implodePathSettings($path_array);
  $config
    ->set('path_pages', $path_string)
    ->save();
  return $path_string;
}