You are here

public function GroupBaseForm::groupExists in Entity Share 8

Same name and namespace in other branches
  1. 8.3 modules/entity_share_server/src/Form/GroupBaseForm.php \Drupal\entity_share_server\Form\GroupBaseForm::groupExists()
  2. 8.2 modules/entity_share_server/src/Form/GroupBaseForm.php \Drupal\entity_share_server\Form\GroupBaseForm::groupExists()

Check to see if a group 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/GroupBaseForm.php, line 73

Class

GroupBaseForm
Class GroupBaseForm.

Namespace

Drupal\entity_share_server\Form

Code

public function groupExists($name) {

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