You are here

protected function YamlFormOptionsForm::alterModuleNames in YAML Form 8

Get form options alter module names.

Return value

array An array of module names that implement hook_yamlform_options_YAMLFORM_OPTIONS_ID_alter().

2 calls to YamlFormOptionsForm::alterModuleNames()
YamlFormOptionsForm::actions in src/YamlFormOptionsForm.php
Returns an array of supported actions for the current entity form.
YamlFormOptionsForm::form in src/YamlFormOptionsForm.php
Gets the actual form array to be built.

File

src/YamlFormOptionsForm.php, line 95

Class

YamlFormOptionsForm
Provides a form to set options.

Namespace

Drupal\yamlform

Code

protected function alterModuleNames() {

  /** @var \Drupal\yamlform\YamlFormOptionsInterface $yamlform_options */
  $yamlform_options = $this->entity;
  if ($yamlform_options
    ->isNew()) {
    return [];
  }
  $hook_name = 'yamlform_options_' . $yamlform_options
    ->id() . '_alter';
  $alter_hooks = $this->moduleHandler
    ->getImplementations($hook_name);
  $module_info = system_get_info('module');
  $module_names = [];
  foreach ($alter_hooks as $options_alter_hook) {
    $module_name = str_replace($hook_name, '', $options_alter_hook);
    $module_names[] = $module_info[$module_name]['name'];
  }
  return $module_names;
}