You are here

public function EntityFields::hideFields in Simplifying 8

Hide entity form fields.

File

src/Services/EntityFields.php, line 78

Class

EntityFields
Class EntityFields.

Namespace

Drupal\simplifying\Services

Code

public function hideFields(&$form, $type) {
  if (!empty($_COOKIE['simplifying'])) {
    return;
  }
  $fields = $this
    ->getFields($type);
  foreach ($fields as $field) {
    $this
      ->hideField($form, $field);
    if ($field == 'field_comments') {
      $this
        ->hideField($form, 'comment');
    }
  }
}