public function ConfigActionsPluginBase::parseOptions in Config Actions 8
Parse any property references in the options.
@oaram array $setKeys a list of property keys to be set if they are simple strings @result array of processed options
Parameters
array $options:
1 call to ConfigActionsPluginBase::parseOptions()
- ConfigActionsPluginBase::setOptions in src/
ConfigActionsPluginBase.php - Process an Options array to set various internal variable defaults.
File
- src/
ConfigActionsPluginBase.php, line 283
Class
- ConfigActionsPluginBase
- Base class for config_actions plugins.
Namespace
Drupal\config_actionsCode
public function parseOptions(array $options, array $setKeys = []) {
$result = [];
if (!empty($this->module)) {
$this->base = DRUPAL_ROOT . '/' . drupal_get_path('module', $this->module);
}
// Perform any property substitution in the loaded defaults.
$replacements = [];
foreach ($this->allowedOptions as $key => $default) {
if (isset($this->{$key}) && is_string($this->{$key})) {
$replacements["@{$key}@"] = $this->{$key};
}
}
foreach ($this->allowedOptions as $key => $default) {
if (isset($this->{$key})) {
$result[$key] = $this
->replaceData($this->{$key}, $replacements);
// Check if this is a string property, or a simple sequential array
// we want to save directly
if ((is_string($this->{$key}) || $this
->isSequential($this->{$key})) && in_array($key, $setKeys)) {
$this->{$key} = $result[$key];
}
}
}
// Update any replacement values with property variables like @id@
if (!empty($this->replace)) {
foreach ($this->replace as $key => $value) {
if (isset($value) && !empty($replacements)) {
$this->replace[$key] = ConfigActionsTransform::replace($value, $replacements);
}
}
}
return $result;
}