public function CountLink::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 AJAXactionLink::getAsFlagLink
File
- modules/
flag_count/ src/ Plugin/ ActionLink/ CountLink.php, line 26
Class
- CountLink
- Provides the Count link type.
Namespace
Drupal\flag_count\Plugin\ActionLinkCode
public function getAsFlagLink(FlagInterface $flag, EntityInterface $entity) {
// Get the render array.
$build = parent::getAsFlagLink($flag, $entity);
// Normally, you'd just override flag.html.twig in your site's theme. For
// this example module, we do something more advanced: Provide a new
// @ActionLinkType that changes the default theme function.
$build['#theme'] = 'flag_count';
// Return the modified render array.
return $build;
}