You are here

public static function SocialSwiftmailTextFormat::process in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_swiftmail/src/Element/SocialSwiftmailTextFormat.php \Drupal\social_swiftmail\Element\SocialSwiftmailTextFormat::process()
  2. 8.7 modules/social_features/social_swiftmail/src/Element/SocialSwiftmailTextFormat.php \Drupal\social_swiftmail\Element\SocialSwiftmailTextFormat::process()
  3. 10.3.x modules/social_features/social_swiftmail/src/Element/SocialSwiftmailTextFormat.php \Drupal\social_swiftmail\Element\SocialSwiftmailTextFormat::process()
  4. 10.0.x modules/social_features/social_swiftmail/src/Element/SocialSwiftmailTextFormat.php \Drupal\social_swiftmail\Element\SocialSwiftmailTextFormat::process()
  5. 10.1.x modules/social_features/social_swiftmail/src/Element/SocialSwiftmailTextFormat.php \Drupal\social_swiftmail\Element\SocialSwiftmailTextFormat::process()
  6. 10.2.x modules/social_features/social_swiftmail/src/Element/SocialSwiftmailTextFormat.php \Drupal\social_swiftmail\Element\SocialSwiftmailTextFormat::process()

Processes a text format form element.

Delete the "Mail HTML" text format from each element of forms which doesn't part of Views bulk process.

Parameters

array $element: The form element to process.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

array $complete_form: The complete form structure.

Return value

array The processed element.

See also

social_swiftmail_element_info_alter()

File

modules/social_features/social_swiftmail/src/Element/SocialSwiftmailTextFormat.php, line 32

Class

SocialSwiftmailTextFormat
Class SocialSwiftmailTextFormat.

Namespace

Drupal\social_swiftmail\Element

Code

public static function process(array &$element, FormStateInterface $form_state, array &$complete_form) {
  if (!$form_state
    ->has('views_bulk_operations')) {
    $format =& $element['format'];
    if (isset($format['format']['#options']['mail_html'])) {
      unset($format['format']['#options']['mail_html']);
      if (count($format['format']['#options']) === 1) {
        $format['format']['#access'] = $format['help']['#access'] = FALSE;
      }
    }
  }
  return $element;
}