You are here

public function ConfirmForm::getUrl in Flag 8.4

Return a Url object for the given flag action.

Parameters

string $action: The action, flag or unflag.

\Drupal\flag\FlagInterface $flag: The flag entity.

\Drupal\Core\Entity\EntityInterface $entity: The flaggable entity.

Return value

Url The Url object for this plugin's flag/unflag route.

Overrides ActionLinkTypeBase::getUrl

File

src/Plugin/ActionLink/ConfirmForm.php, line 23

Class

ConfirmForm
Provides the Confirm Form link type.

Namespace

Drupal\flag\Plugin\ActionLink

Code

public function getUrl($action, FlagInterface $flag, EntityInterface $entity) {
  switch ($action) {
    case 'flag':
      return Url::fromRoute('flag.confirm_flag', [
        'flag' => $flag
          ->id(),
        'entity_id' => $entity
          ->id(),
      ]);
    default:
      return Url::fromRoute('flag.confirm_unflag', [
        'flag' => $flag
          ->id(),
        'entity_id' => $entity
          ->id(),
      ]);
  }
}