You are here

protected function RemoteForm::getSelectedPlugin in Entity Share 8.3

Helper method to get selected plugin from the form.

Parameters

array $form: The form.

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

Return value

\Drupal\entity_share_client\ClientAuthorization\ClientAuthorizationInterface The selected plugin.

3 calls to RemoteForm::getSelectedPlugin()
RemoteForm::save in modules/entity_share_client/src/Form/RemoteForm.php
Form submission handler for the 'save' action.
RemoteForm::submitForm in modules/entity_share_client/src/Form/RemoteForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
RemoteForm::validateForm in modules/entity_share_client/src/Form/RemoteForm.php
Form validation handler.

File

modules/entity_share_client/src/Form/RemoteForm.php, line 252

Class

RemoteForm
Entity form of the remote entity.

Namespace

Drupal\entity_share_client\Form

Code

protected function getSelectedPlugin(array &$form, FormStateInterface $form_state) {
  $authPluginId = $form_state
    ->getValue('pid');
  $plugins = $form['auth']['#plugins'];

  /** @var \Drupal\entity_share_client\ClientAuthorization\ClientAuthorizationInterface $selectedPlugin */
  $selectedPlugin = $plugins[$authPluginId];
  return $selectedPlugin;
}