You are here

protected function WebformTranslationConfigManager::alterConfigWebformForm in Webform 6.x

Alter the webform configuration form.

Parameters

string $config_name: The webform configuration name.

array $config_element: The webform configuration element.

$form: Nested array of form elements that comprise the form.

$form_state: The current state of the form.

1 call to WebformTranslationConfigManager::alterConfigWebformForm()
WebformTranslationConfigManager::alterForm in src/WebformTranslationConfigManager.php
Alter config translation form.

File

src/WebformTranslationConfigManager.php, line 235

Class

WebformTranslationConfigManager
Defines a class to translate webform config.

Namespace

Drupal\webform

Code

protected function alterConfigWebformForm($config_name, &$config_element, &$form, $form_state) {
  $this
    ->alterConfigWebformFormElements($config_name, $config_element, $form, $form_state);
  $this
    ->alterConfigWebformFormHandlers($config_name, $config_element, $form, $form_state);
  $this
    ->alterTypedConfigElements($config_element, "webform.webform.*");
  $webform = $this
    ->loadWebform($config_name);
  $source_elements = $this->translationManager
    ->getSourceElements($webform);
  $form_state
    ->set('webform_config_name', $config_name);
  $form_state
    ->set('webform_source_elements', $source_elements);

  // Tweak form elements.
  $element_alterations = [
    // Form settings.
    'title' => [
      '#maxlength' => NULL,
    ],
    // Submission settings.
    'submission_label' => [
      '#maxlength' => NULL,
    ],
    // Email handler.
    // @see \Drupal\webform\Plugin\WebformHandler\EmailWebformHandler
    'subject' => [
      '#maxlength' => NULL,
    ],
    'from_name' => [
      '#maxlength' => 255,
    ],
    'sender_name' => [
      '#maxlength' => 255,
    ],
  ];
  $this
    ->alterElements($config_element, $element_alterations);
  $form['#validate'][] = [
    get_called_class(),
    'validateWebformForm',
  ];
}