You are here

protected function ReplicationActionForm::getEntity in Deploy - Content Staging 8

Returns the entity object itself or an EntityMalformedException if error.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: Form State values.

Return value

\Drupal\workspace\Entity\Replication The expected parent class for $entity.

Throws

EntityMalformedException

2 calls to ReplicationActionForm::getEntity()
ReplicationActionForm::buildForm in src/Form/ReplicationActionForm.php
Implements buildForm().
ReplicationActionForm::submitForm in src/Form/ReplicationActionForm.php
Implements submitForm().

File

src/Form/ReplicationActionForm.php, line 215

Class

ReplicationActionForm
ReplicationActionForm class.

Namespace

Drupal\deploy\Form

Code

protected function getEntity(FormStateInterface $form_state) {
  $args = $form_state
    ->getBuildInfo()['args'];

  /** @var \Drupal\workspace\Entity\Replication $entity */
  $entity = $args[0];
  if ($entity instanceof Replication) {
    return $entity;
  }
  throw new EntityMalformedException('Invalid Replication entity given.');
}