You are here

public function FilterBaseForm::filterExists in Entity Share 8.2

Same name and namespace in other branches
  1. 8.3 modules/entity_share_server/src/Form/FilterBaseForm.php \Drupal\entity_share_server\Form\FilterBaseForm::filterExists()
  2. 8 modules/entity_share_server/src/Form/FilterBaseForm.php \Drupal\entity_share_server\Form\FilterBaseForm::filterExists()

Check to see if a filter already exists with the specified name.

Parameters

string $name: The machine name to check for.

Return value

bool True if it already exists.

File

modules/entity_share_server/src/Form/FilterBaseForm.php, line 122

Class

FilterBaseForm
Class FilterBaseForm.

Namespace

Drupal\entity_share_server\Form

Code

public function filterExists($name) {

  /** @var \Drupal\entity_share_server\Entity\ChannelInterface $channel */
  $channel = $this->entity;
  $channel_filters = $channel
    ->get('channel_filters');
  if (is_null($channel_filters)) {
    return FALSE;
  }
  if (isset($channel_filters[$name])) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}