Add Twig function to generate flag/unflag links

Created on 9 November 2024, 6 days ago

Problem/Motivation

Currently, there's no easy way to generate flag/unflag links in Twig templates. Developers need to inject the flag.link_builder service into their controllers or use service container directly to build these links. This creates unnecessary boilerplate code and makes templates less maintainable.

Proposed resolution

Add a new Twig extension that provides a `flaglink()` function to generate flag/unflag links directly in templates, similar to the existing `flagcount()` function.

Example usage:

{{ flaglink('node', node.id, 'bookmark') }}

Feature request
Status

Active

Version

4.0

Component

Flag core

Created by

🇵🇹Portugal introfini

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024