You are here

public function ViewExecutable::hasFormElements in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::hasFormElements()

Determines if this view has form elements.

Return value

bool TRUE if this view contains handlers with views form implementations, FALSE otherwise.

File

core/modules/views/src/ViewExecutable.php, line 2452

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

public function hasFormElements() {
  foreach ($this->field as $field) {
    if (property_exists($field, 'views_form_callback') || method_exists($field, 'viewsForm')) {
      return TRUE;
    }
  }
  $area_handlers = array_merge(array_values($this->header), array_values($this->footer));
  $empty = empty($this->result);
  foreach ($area_handlers as $area) {
    if (method_exists($area, 'viewsForm') && !$area
      ->viewsFormEmpty($empty)) {
      return TRUE;
    }
  }
  return FALSE;
}