You are here

public function OpenIDConnectClientFormBase::exists in OpenID Connect / OAuth client 2.x

Checks for an existing OpenID Connect client.

Parameters

string|int $entity_id: The entity ID.

array $element: The form element.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

Return value

bool TRUE if this format already exists, FALSE otherwise.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

src/Form/OpenIDConnectClientFormBase.php, line 132

Class

OpenIDConnectClientFormBase
Form handler for the OpenID Connect client add and edit forms.

Namespace

Drupal\openid_connect\Form

Code

public function exists($entity_id, array $element, FormStateInterface $form_state) : bool {
  $result = $this->entityTypeManager
    ->getStorage('openid_connect_client')
    ->getQuery()
    ->condition('id', $element['#field_prefix'] . $entity_id)
    ->execute();
  return (bool) $result;
}