Provide documentation for 4.x branch

Created on 8 July 2020, over 4 years ago
Updated 17 February 2023, almost 2 years ago

Now that a beta release is out, it would be great to update the documentation and provide some code examples for 4.x as was done for 3.x .

A good start would be copying the structure of the linked page but updating the code examples for 4.x (since the code is completely different in D8).

🐛 Bug report
Status

Active

Version

4.0

Component

Documentation

Created by

🇯🇵Japan ptmkenny

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom problue solutions Northern Ireland

    Discovering whether a piece of content is flagged

    Use the isFlagged() method to find out if an item is flagged.

    Example:

    $flag_id = 'bookmark';

    $flag_service = \Drupal::service('flag');
    $flag = $flag_service->getFlagById($flag_id);

    if ($flag && $flag->isFlagged($entity) {
    print "This entity has been bookmarked!";
    }

    Is this supposed to return true if the flag id is flagged by any user for the given entity?

    Im trying this code and it isnt returning true for a flag id that i know for sure is flagged by at least one user for the given entity.

Production build 0.71.5 2024