You are here

public function SortBaseForm::sortExists in Entity Share 8.3

Same name and namespace in other branches
  1. 8 modules/entity_share_server/src/Form/SortBaseForm.php \Drupal\entity_share_server\Form\SortBaseForm::sortExists()
  2. 8.2 modules/entity_share_server/src/Form/SortBaseForm.php \Drupal\entity_share_server\Form\SortBaseForm::sortExists()

Check to see if a sort 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/SortBaseForm.php, line 48

Class

SortBaseForm
Base class to sort form.

Namespace

Drupal\entity_share_server\Form

Code

public function sortExists($name) {

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