You are here

public function AJAXactionLink::getAsFlagLink in Flag 8.4

Get the action link formatted for use in entity links.

Parameters

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

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

Return value

array The render array.

Overrides ActionLinkTypeBase::getAsFlagLink

1 call to AJAXactionLink::getAsFlagLink()
CountLink::getAsFlagLink in modules/flag_count/src/Plugin/ActionLink/CountLink.php
Get the action link formatted for use in entity links.
1 method overrides AJAXactionLink::getAsFlagLink()
CountLink::getAsFlagLink in modules/flag_count/src/Plugin/ActionLink/CountLink.php
Get the action link formatted for use in entity links.

File

src/Plugin/ActionLink/AJAXactionLink.php, line 79

Class

AJAXactionLink
Provides the AJAX link type.

Namespace

Drupal\flag\Plugin\ActionLink

Code

public function getAsFlagLink(FlagInterface $flag, EntityInterface $entity) {
  $build = parent::getAsFlagLink($flag, $entity);
  $build['#attached']['library'][] = 'flag/flag.link_ajax';
  $build['#attributes']['class'][] = 'use-ajax';
  return $build;
}