You are here

protected function WebformOptionsForm::alterModuleNames in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/WebformOptionsForm.php \Drupal\webform\WebformOptionsForm::alterModuleNames()

Get webform options alter module names.

Return value

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

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

File

src/WebformOptionsForm.php, line 172

Class

WebformOptionsForm
Provides a form to set options.

Namespace

Drupal\webform

Code

protected function alterModuleNames() {

  /** @var \Drupal\webform\WebformOptionsInterface $webform_options */
  $webform_options = $this->entity;
  if ($webform_options
    ->isNew()) {
    return [];
  }
  $hook_name = 'webform_options_' . $webform_options
    ->id() . '_alter';
  $alter_hooks = $this->moduleHandler
    ->getImplementations($hook_name);
  $module_info = $this->moduleExtensionList
    ->getAllInstalledInfo();
  $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;
}