public function Define::execute in Drupal 7 to 8/9 Module Upgrader 8
Executes the plugin.
Overrides ExecutableInterface::execute
File
- src/
Plugin/ DMU/ Fixer/ Define.php, line 16
Class
- Define
- Plugin annotation @Fixer( id = "define" )
Namespace
Drupal\drupalmoduleupgrader\Plugin\DMU\FixerCode
public function execute() {
$file = $this
->getUnaliasedPath($this->configuration['in']);
$data = file_exists($file) ? YAML::decode(file_get_contents($file)) : [];
$keys = explode('/', $this->configuration['key']);
NestedArray::setValue($data, $keys, $this->configuration['value']);
file_put_contents($file, YAML::encode($data));
}