You are here

public function EntityFields::hideTextFormatElements in Simplifying 8

Hide entity form text format elements.

1 call to EntityFields::hideTextFormatElements()
EntityFields::hideField in src/Services/EntityFields.php
Hide entity form field.

File

src/Services/EntityFields.php, line 117

Class

EntityFields
Class EntityFields.

Namespace

Drupal\simplifying\Services

Code

public function hideTextFormatElements(&$form) {
  foreach (Element::children($form) as $key) {
    if (!isset($form[$key]['#type']) || $form[$key]['#type'] == 'container') {
      $this
        ->hideTextFormatElements($form[$key]);
    }
    elseif ($form[$key]['#type'] == 'text_format') {
      $form[$key]['#after_build'][] = __CLASS__ . '::hideTextFormatElement';
    }
  }
}