Issues for Flag: Recent Episodes

None

View Details

Problem/MotivationThe flag link URL "destination" query argument includes the entity URL, but also the same URL unnecessarily repeated as a "?q=" query argument.

This breaks in newer Apache versions that take exception to having "?" encoded as %3F in a query argument that is being rewritten. Adding "UnsafeAllow3F" to the Drupal main rewrite rule works around this security limitation:

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,UnsafeAllow3F]

This works around the problem, but ideally the URL created by Flag should not include the "?q=" part.

Will investigate further when I get time.

View Details

Using of renderPlain is deprecated since 10.3.0 and needs to be replaced with renderInIsolation.

View Details

Problem/MotivationTests are failing since #3376846: Implement the new access policy API.

\Drupal\Tests\flag_follower\Functional\FlagFollowerUITest::doContentView() specifically, we're missing some kind of cache context apparently.

It's a user placeholder, specifically on a relationship of a view: \Drupal\flag\Plugin\views\relationship\FlagViewsRelationship::query().

Steps to reproduceProposed resolutionRemaining tasksUser interface changesAPI changesData model changes

View Details

Problem/MotivationAs drupal supports autowire add aliases to services.

Core CR: https://www.drupal.org/node/3218156

Proposed resolutionCreate service aliases for public services:
- flag
- flag.link_builder

Remaining tasks- Create aliases

User interface changesNo changes

API changesShould not be any

Data model changesNo changes

View Details

Problem/MotivationCurrently for a flag type you can only globally configure settings like "Link type" at /admin/structure/flags/manage/{FLAG-TYPE}

This is generally okay and makes sense, but it would be better and make things more flexible and Drupal-way if you could override this in the field display settings, when using the "Display link as field" functionality (which is great!)

That way you could for example render the flag as AJAX link in one view mode, e.g. Full and as View-Only in Teaser.

Steps to reproduceDisplay the flag link as field and try to configure the "Link type" differently for view modes of the entity it is applied on. Currently this is only possible through custom coding, but could be solved by field formatter settings instead.

Proposed resolutionImplement the display settings as field formatter

Remaining tasks1. Discuss 2. Implement 3. Test 4. Release

User interface changesAPI changesData model changes

View Details

Flag is an extremely useful module, and I have built support for it into the Event Platform, which I will soon be porting to Drupal 11. Because the Event Platform (and a couple of other projects I maintain) make use of Flag, I would like to help with maintenance here as well.

My immediate priorities would be to clean up the remaining issues identified by GitlabCI, clean up the issue queue, and get a Drupal 11-ready release cut.

View Details

Problem/MotivationFlagging an entity currently creates a record in the "flagging" table:

$flagging = $this->entityTypeManager->getStorage('flagging')->create([ 'uid' => $account->id(), 'session_id' => $session_id, 'flag_id' => $flag->id(), 'entity_id' => $entity->id(), 'entity_type' => $entity->getEntityTypeId(), 'global' => $flag->isGlobal(), ]); (FlagService.php)

FlagCountManager then registers an event to count up the counter in "flag_counts":

/** * {@inheritdoc} */ public static function getSubscribedEvents() { $events = []; $events[FlagEvents::ENTITY_FLAGGED][] = ['incrementFlagCounts', -100]; $events[FlagEvents::ENTITY_UNFLAGGED][] = [ 'decrementFlagCounts', -100, ]; return $events; } using

/** * Increments count of flagged entities. * * @param \Drupal\flag\Event\FlaggingEvent $event * The flagging event. */ public function incrementFlagCounts(FlaggingEvent $event) { $flagging = $event->getFlagging(); $flag = $flagging->getFlag(); $entity = $flagging->getFlaggable(); if (!empty($entity) && !empty($flag)) { $this->connection->merge('flag_counts') ->key([ 'flag_id' => $flag->id(), 'entity_id' => $entity->id(), 'entity_type' => $entity->getEntityTypeId(), ]) ->fields([ 'last_updated' => $this->dateTime->getRequestTime(), 'count' => 1, ]) ->expression('count', 'count + :inc', [':inc' => 1]) ->execute(); $this->resetLoadedCounts($entity, $flag); } } However it can happen that the counts get out of sync, so it would be nice to have an action to recalculate the all the counts in flag_counts from flagging.

This issue is to discuss if such a function would make sense and where / how to place it.

Steps to reproduceProposed resolutionI think it should be a batch functionality and am not yet sure, where to place it best. I think I'd expect it as separate tab in the flag type configuration, perhaps like this:
/admin/structure/flags/manage/likes/actions

Remaining tasksUser interface changesAPI changesData model changes

View Details

Problem/MotivationThe 8.x version of the Flag module lacks a relationship with "Users Flagged Content" in a User View (this feature existed in Drupal 7, but was remove in the migration to 8). This would provide the ability in a User-based View to relate to the user's flagged entities.

Use CaseA common use case for this feature would be to display a list of users who have flagged a specific node. By having a "User's Flaggings" relationship available in User Views, a contextual filter could be applied using the "Entity ID" of the flagged node. This would enable the view to dynamically display users based on the node ID provided through the contextual filter.

View Details

This more of a inquiry i guess but here is my confusion.

Use Case
i run flags as a genre tagging system for a movie database, i use the field of checkboxes to allow multiple genres to be added through the dialog option but my confusion is if its a global flag, any user (with permissions) that bring up the dialog window should see what genres have already been added to remove the issue of duplicate genres (or tags) on the page, or i mis-understanding the use of the word "Global" here.

View Details

I'm not a coder myself, but maybe somebody with some extra spare time can have a look at the following upgrade status output to make the module work with drupal 11.

Problem/MotivationThe module is not ready for drupal 11. I ran upgrade_status on the module with the following results:

================================================================================Flag, 8.x-4.0-beta4Scanned on zo 05/12/2024 - 14:22FILE:\flag\src\Controller\FlagListBuilder.phpSTATUS LINE MESSAGE--------------------------------------------------------------------------------Fix later 53 Call to deprecated function user_roles(). Deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use Drupal\user\Entity\Role::loadMultiple() and, if necessary, an inline implementation instead.--------------------------------------------------------------------------------FILE: \flag\src\Form\FlagFormBase.phpSTATUS LINE MESSAGE--------------------------------------------------------------------------------Fix later 350 Call to deprecated function user_roles(). Deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use Drupal\user\Entity\Role::loadMultiple() and, if necessary, an inline implementation instead.--------------------------------------------------------------------------------FILE:\flag\src\Plugin\views\relationship\FlagViewsRelationship.phpSTATUS LINE MESSAGE--------------------------------------------------------------------------------Fix later 148 Call to deprecated function user_roles(). Deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use Drupal\user\Entity\Role::loadMultiple() and, if necessary, an inline implementation instead.--------------------------------------------------------------------------------FILE:\flag\tests\src\Functional\AdminUITest.phpSTATUS LINE MESSAGE--------------------------------------------------------------------------------Check manually 188 Relying on entity queries to check access by default is deprecated in drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with TRUE or FALSE to specify whether access should be checked.--------------------------------------------------------------------------------Check manually 204 Relying on entity queries to check access by default is deprecated in drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with TRUE or FALSE to specify whether access should be checked.--------------------------------------------------------------------------------FILE: modules/contrib/flag/flag.info.ymlSTATUS LINE MESSAGE--------------------------------------------------------------------------------Check manually 3 Value of core_version_requirement: ^9.1 || ^10 is not compatible with the next major version of Drupal core. See https://drupal.org/node/3070687.--------------------------------------------------------------------------------FILE: modules/contrib/flag/modules/flag_bookmark/flag_bookmark.info.ymlSTATUS LINE MESSAGE--------------------------------------------------------------------------------Check manually 3 Value of core_version_requirement: ^9.1 || ^10 is not compatible with the next major version of Drupal core. See https://drupal.org/node/3070687.--------------------------------------------------------------------------------FILE: modules/contrib/flag/modules/flag_count/flag_count.info.ymlSTATUS LINE MESSAGE--------------------------------------------------------------------------------Check manually 3 Value of core_version_requirement: ^9.1 || ^10 is not compatible with the next major version of Drupal core. See https://drupal.org/node/3070687.--------------------------------------------------------------------------------FILE: modules/contrib/flag/modules/flag_follower/flag_follower.info.ymlSTATUS LINE MESSAGE--------------------------------------------------------------------------------Check manually 3 Value of core_version_requirement: ^9.1 || ^10 is not compatible with the next major version of Drupal core. See https://drupal.org/node/3070687.-------------------------------------------------------------------------------- Proposed resolutionFix these small problems so that the module can be used on drupal 11 installs.

View Details

Problem/MotivationLet's say you have an article content with 'Like' flags. And you want to create a table with just two fields:

  • Content title
  • Number of likes

To implement this, currently you have to implement a "Flags" relationship, which creates a JOIN to the flagging table to do a WHERE on the flag type value and another join on flag_counts table to get the count. This can get slow if there are a multiple likes for a content on the site.
This can get reallllyyyy slow if any kind of aggregation is added to views, which you have to in this case because of multiple matches for a content in the flagging table.

Steps to reproduceProposed resolutionAdd a new relationship for flag counts for an entity that bypasses the join to flagging table and uses flag_counts table directly.

Remaining tasksUser interface changesAPI changesData model changes

View Details

Problem/Motivation

Hello. When adding a relationship with a flag for the current user, the handler does not provide the correct cache context, and unless other handlers provide the user's context, the cache will be shared by all users.

Proposed resolution

I suggest adding a CacheableDependencyInterface implementation to the relationship handler with a flag in views to provide the correct cache context.

View Details

Problem/Motivation As far as I can see, there is no method to get all flags for a particular user.

Steps to reproduce n/a

Proposed resolution Add a method to \Drupal\flag\FlagService - perhaps call it getFlagsByUser

Remaining tasks 1. add the method

  1. use it in \Drupal\flag\FlagService::unflagAllByUser

User interface changes none

API changes Add new method on FlagService

Data model changes none

View Details

Drupal version : 10.1.2

DB driver : pgsql

PHP version : 8.1.0

Drush version : 12.1.2.0

search_api version: '8.x-1.29'

drush sapi-i my_collection_name --limit 100

```

[error] Drupal\Core\Entity\Query\QueryException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in Drupal\Core\Entity\Query\Sql\Query->prepare() (line 162 of /Applications/MAMP/htdocs/core/lib/Drupal/Core/Entity/Query/Sql/Query.php). [error] Drupal\Core\Entity\EntityStorageException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete() (line 763 of /Applications/MAMP/htdocs/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php). An error occurred during indexing on My Collection Name Index: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). [error] Message: Couldn't index items. Check the logs for details. ```

core/lib/Drupal/Core/Entity/Query/Sql/Query.php

``` use Drupal\Core\Logger\RfcLogLevel; ...

\Drupal::logger('custom')->log(RfcLogLevel::DEBUG, $this->sqlQuery->__toString());
// $e = new \Exception;
// \Drupal::logger('custom')->error($e->getTraceAsString());
if (is_null($this->accessCheck)) {
  throw new QueryException('Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck().');
}

```

With this log added I see the following:

[Wed, 08/16/2023 - 09:45 EDT] [Debug] [custom] [client: 127.0.0.1, Anonymous] SELECT \nFROM\n@search_api_task "base_table" [Wed, 08/16/2023 - 09:45 EDT] [Error] [search_api_task] [client: 127.0.0.1, Anonymous] Drupal\Core\Entity\Query\QueryException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in Drupal\Core\Entity\Query\Sql\Query->prepare() (line 162 of /Applications/MAMP/htdocs/core/lib/Drupal/Core/Entity/Query/Sql/Query.php). [Wed, 08/16/2023 - 09:45 EDT] [Error] [search_api] [client: 127.0.0.1, Anonymous] Drupal\Core\Entity\EntityStorageException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete() (line 763 of /Applications/MAMP/htdocs/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

From what I understand we need to add accessChecks like the following:

diff --git a/modules/contrib/search_api/src/Task/TaskManager.php b/modules/contrib/search_api/src/Task/TaskManager.php index 1b86a8581..a2d78a18d 100644 --- a/modules/contrib/search_api/src/Task/TaskManager.php +++ b/modules/contrib/search_api/src/Task/TaskManager.php @@ -151,7 +151,7 @@ public function addTask($type, ServerInterface $server = NULL, IndexInterface $i 'server_id' => $server_id, 'index_id' => $index_id, 'data' => $data, - ])->execute(); + ])->accessCheck(FALSE)->execute(); if ($result) { return $this->getTaskStorage()->load(reset($result)); } @@ -170,7 +170,7 @@ public function addTask($type, ServerInterface $server = NULL, IndexInterface $i * {@inheritdoc} */ public function loadTasks(array $conditions = []) { - $task_ids = $this->getTasksQuery($conditions)->execute(); + $task_ids = $this->getTasksQuery($conditions)->accessCheck(FALSE)->execute(); if ($task_ids) { return $this->getTaskStorage()->loadMultiple($task_ids); } @@ -195,6 +195,7 @@ public function deleteTasks(array $conditions = []) { while (TRUE) { $task_ids = $this->getTasksQuery($conditions) ->range(0, 100) + ->accessCheck(FALSE) ->execute(); if (!$task_ids) { break; @@ -228,7 +229,7 @@ public function executeSpecificTask(TaskInterface $task) { * {@inheritdoc} */ public function executeSingleTask(array $conditions = []) { - $task_id = $this->getTasksQuery($conditions)->range(0, 1)->execute(); + $task_id = $this->getTasksQuery($conditions)->range(0, 1)->accessCheck(FALSE)->execute(); if ($task_id) { $task_id = reset($task_id); /** @var \Drupal\search_api\Task\TaskInterface $task */

But so far I have not been able to resolve this.

View Details

Problem/Motivation It would be useful if FlagCountManager offered a method to count a particular flag. This would be like ::getEntityFlagCounts() except that it would also take a string flag_id param and return an integer, the count for that flag_id.

Proposed resolution Add a new method.

Remaining tasks Agree on the name of the method. Implement.

User interface changes None.

API changes Method is added.

Data model changes None.

View Details

Problem/Motivation After upgrading my php verision to 8.1 and clearing cache the flags module does not work as expected. Site crashes with warnings in watchdog:

Warning: Undefined array key "normal" in /var/www/html/sites/all/modules/contrib/flag/includes/flag/flag_flag.inc on line 1214

arning: Trying to access array offset on value of type null in /var/www/html/sites/all/modules/contrib/flag/includes/flag/flag_flag.inc on line 203

Steps to reproduce Proposed resolution Remaining tasks User interface changes API changes Data model changes

View Details

Problem/Motivation I'm trying to create an ECA model that sends an email notification to users when a new comment is posted to a node they have flagged.

In this case, I want to receive a list of users, therefore, when creating a new view it needs to be a new view for users. As I want to receive those users only, who flagged the node which just got commented, I need to add a chain of relationships:

Flags: link from the user to all its flags

Node: link from the flag to the related node

Comment: link from the node to all related comments

So I created a new view for users. And when I start first relationship with Flags, I'm not able to because Flags is not available as shown in the screenshot:

Proposed resolution Please allow to add flags link from users to its flags in Users views.

View Details

Using PHP 8.1.19, Centos 7

Flag 4.0@beta, and Drupal core 9.5.8

Referrer /node/add/page

Deprecated function: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Database\Connection->escapeLike() (line 1525 of /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Database/Connection.php)

0 /var/www/html/ehss_stage/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real()

1 [internal function]: _drupal_error_handler()

2 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Database/Connection.php(1525): addcslashes()

3 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Database/Query/Select.php(431): Drupal\Core\Database\Connection->escapeLike()

4 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php(125): Drupal\Core\Database\Query\Select->escapeLike()

5 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php(70): Drupal\Core\Entity\Query\Sql\Condition::translateCondition()

6 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(177): Drupal\Core\Entity\Query\Sql\Condition->compile()

7 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(81): Drupal\Core\Entity\Query\Sql\Query->compile()

8 /var/www/html/ehss_stage/web/modules/contrib/flag/src/FlagService.php(233): Drupal\Core\Entity\Query\Sql\Query->execute()

9 /var/www/html/ehss_stage/web/modules/contrib/message_subscribe/message_subscribe_email/message_subscribe_email.module(24): Drupal\flag\FlagService->getAllEntityFlaggings()

10 [internal function]: message_subscribe_email_flag_action_access()

11 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(426): call_user_func_array()

12 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension{closure}()

13 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(433): Drupal\Core\Extension\ModuleHandler->invokeAllWith()

14 /var/www/html/ehss_stage/web/modules/contrib/flag/src/FlagType/FlagTypeBase.php(179): Drupal\Core\Extension\ModuleHandler->invokeAll()

15 /var/www/html/ehss_stage/web/modules/contrib/flag/src/Plugin/Flag/EntityFlagType.php(315): Drupal\flag\FlagType\FlagTypeBase->actionAccess()

16 /var/www/html/ehss_stage/web/modules/contrib/flag/src/Entity/Flag.php(343): Drupal\flag\Plugin\Flag\EntityFlagType->actionAccess()

17 /var/www/html/ehss_stage/web/modules/contrib/flag/flag.module(150): Drupal\flag\Entity\Flag->actionAccess()

18 [internal function]: {closure}()

19 /var/www/html/ehss_stage/web/modules/contrib/flag/flag.module(155): array_filter()

20 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(562): flag_form_alter()

21 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Form/FormBuilder.php(838): Drupal\Core\Extension\ModuleHandler->alter()

22 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Form/FormBuilder.php(282): Drupal\Core\Form\FormBuilder->prepareForm()

23 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()

24 /var/www/html/ehss_stage/web/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult()

25 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()

26 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()

27 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}()

28 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()

29 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()

30 /var/www/html/ehss_stage/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}()

31 /var/www/html/ehss_stage/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()

32 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()

33 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()

34 /var/www/html/ehss_stage/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()

35 /var/www/html/ehss_stage/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()

36 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()

37 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()

38 /var/www/html/ehss_stage/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()

39 /var/www/html/ehss_stage/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()

40 /var/www/html/ehss_stage/web/index.php(19): Drupal\Core\DrupalKernel->handle()

41 {main}

View Details

Flagging cancel link seems to redirect to wrong path when using confirm form, when you have the website installed in subfolder.

For example, I got site installed in domain.com/a/b/c/. When I use the confirm form for flagging and whenever I use the cancel button after clicking flag/unflag link, the redirect takes me to domain.com/a/b/c/a/b/c/<correct-path>. So it adds the subfolders where the site is installed to the redirect path again, when it should just use Drupal path.

When I hover over the initial flag/unflag link, I can see the ?destination path is set to ?destination=/a/b/c/<correct-path>, which is probably why the redirect ends up adding the folders again in the URL. If I manually remove those values from ?destination and just leave plain Drupal path there (like ?destination=user/1 instead of ?destination=/a/b/c/user/1), everything works fine.

I would assume this doesn't happen when site is installed in domain root.

View Details

Spelling mistake in flag module". I have raise MR for the same. Kindly review.

View Details

I'm trying to create a hook to flag a node when it is created automatically. This is the general approach I'm following.

<?phpfunction hook\_node\_insert($node) { $flag\_service = \Drupal::service('flag'); $flag\_entity = $flag\_service->getFlagById('flag\_machine\_name'); $flag\_service->flag($flag\_entity, $node); $node->save();}?>

However this is not working as expected. Is there some other step that needs to happen?

View Details

Problem/Motivation

Hi,
In the flag count -module, which has a template:
modules/contrib/flag/modules/flag\_count/templates/flag-count.html.twig

This template outputs the Flag count number inside []
So on a web browser it looks Count [4].

I think these "[" "]" are unecessary and related to styling.
I have to override thoes with a template, it is not a problem
but just thought could those be removed so that it would look like Count 4.

And if someone needs those brackets around the number, could override?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

View Details

Problem/Motivation

In #3090414: Fix coding standards it was found the implementation of hook\_requirements is responsible for a lot of code style violations. However, it does basically nothing, with the meat of the function commented out. We need to assess whether we need anything from this and re-implement it; doing this is outside the scope of #3090414: Fix coding standards, where wil will simply remove it for now.

/** * Implements hook\_requirements(). */function flag\_requirements($phase) { $requirements = []; /* if ($phase == 'runtime') { if (\Drupal::moduleHandler()->moduleExists('translation') && !\Drupal::moduleHandler()->moduleExists('translation\_helpers')) { $requirements['flag\_translation'] = array( 'title' => t('Flag'), 'severity' => REQUIREMENT\_ERROR, 'description' => t('To have the flag module work with translations, you need to install and enable the <a href="http://drupal.org/project/translation\_helpers">Translation helpers</a> module.'), 'value' => t('Translation helpers module not found.'), ); } if (\Drupal::moduleHandler()->moduleExists('session\_api')) { if (file\_exists('./robots.txt')) { $flag\_path = url('flag') . '/'; // We don't use url() because this may return an absolute URL when // language negotiation is set to 'domain'. $flag\_path = parse\_url($flag\_path, PHP\_URL\_PATH); $robots\_string = 'Disallow: ' . $flag\_path; $contents = file\_get\_contents('./robots.txt'); if (strpos($contents, $robots\_string) === FALSE) { $requirements['flag\_robots'] = array( 'title' => t('Flag robots.txt problem'), 'severity' => REQUIREMENT\_WARNING, 'description' => t('Flag module may currently be used with anonymous users, however the robots.txt file does not exclude the "@flag-path" path, which may cause search engines to randomly flag and unflag content when they index the site. It is highly recommended to add "@robots-string" to your robots.txt file (located in the root of your Drupal installation).', array('@flag-path' => $flag\_path, '@robots-string' => $robots\_string)), 'value' => t('Search engines flagging content'), ); } } } } */ return $requirements;}

Proposed resolution

Assess whether we still need anything from this implementation and if so, re-implement it. In the current version of the module, it does nothing.

Remaining tasks

  • Assess what we need from a hook\_requirements(), if anything
  • Make the necessary changes
  • Review
  • Merge

User interface changes

Requirements checks listed in site status report (?)

API changes

None.

Data model changes

None.

View Details

Problem/Motivation

Our Site, running since since 2021, has extensive use of webforms and views. after yesterdays update from 9.5.3 to 9.5.4 one form stopped to load. Editing/disabling components revealed that the source was in tables. We recreated the table - it worked. we changed sort order on the creation date field to 'descending' and the problem reoccured

Steps to reproduce

  • Create a View from Webform Submissions
  • Include the creation date
  • select table display and creation date field as standard sort order

It works. Admins preview underneath is filled with content

  • now change the sort order of the field to 'descending'

Admins preview is empty. Users receive an error message.

The website encountered an unexpected error. Please try again later.

Proposed resolution

Differences from 9.5.3 to 9.5.4 to be investigated. In the meantime, disable 'descending'.

Remaining tasks

Fix needed, appearently no workaround possible.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Release notes snippet

Descending sort by date of webform submission not working anymore

View Details

All flags stored by the anonymous users are deleted when the browser is closed!
Is there a way I am missing where I can extend the life of those cookies?
I don't want to delete cookies related to flags when the browser is closed.
Any help?

View Details

I'm trying the get a flag count that is used in a node using view blocks. If I add Flags relationship to views, I get list with a same node instead of different.

What is the best way to get node flag count in a views?

View Details

Problem/Motivation

The module description of the "flag\_count" module says the following:

Provides an example on how to display flag counts

But this module provides a perfectly fine "Count link" link type which additionally displays the flag count together with the flag itself. The description of this type is:

An example AJAX action link which displays the count with the flag.

Which should be changed as well, because this flag type isn't an example.

Steps to reproduce

Proposed resolution

Fix the strings accordingly.

Remaining tasks

User interface changes

API changes

Data model changes

View Details

Problem/Motivation

Flags that use the 'Field Entry Form' Link Type option do not have a proper 'Unflag' link to display for removing the flagging. Currently, the unflag link points to the edit form for field entry.

Steps to reproduce

1. Create a Flag with the 'Field Entry Form' Link Type option and save the Flag.
2. Display the entities the Flag is attached to in a View.
3. Add a 'Flags' relationship to the View that has the description 'Limit results to only those entity flagged by a certain flag; Or display information about the flag set on a entity.'
4. Add a 'Flagging: Flag link' field to the View that has the description 'Display flag/unflag link.'
5. Perform the flag link action on an entity in the View
6. Perform the unflag link action on an entity in the View
7. Observe that the 'Unflag' action link points to the 'Field Entry Form' edit form instead of the delete form.

Proposed resolution

Use the delete form route instead of the edit form route for the unflag link action on Field Entry forms. Update the method 'FieldEntry::getUrl' to have an 'unflag' action case with the delete form route for Field Entry.

Remaining tasks

Approve a patch to add the 'unflag' action link option with the delete form route in the 'FieldEntry::getUrl' method.

User interface changes

None.

API changes

None.

Data model changes

The Field Entry 'unflag' link will point to the delete form instead of the edit form when using the 'Field Entry Form' Link Type option on a Flag.

View Details

Problem/Motivation

When the module is configured to display the reporting form in a dialog, the form is grayed out and is unusable. This doesn't happen in all cases and seems dependent on factors such as theme styles, etc.

Steps to reproduce

Go to a node that has comments on it. Click on the link to flag a comment. When the dialog opens, it is grayed out and unusable.

Screenshot of issue

Proposed resolution

In my case, this was only happening for specific roles so I initially thought it was a permissions related issue, but upon further investigation it was determined that a z-index was not being applied to both the dialog and it's overlay.

Screenshot of DOM inspector

Reviewing the API documentation for Ajax Dialog Boxes it appears that the Flag module fails to define the required dependency on the core/drupal.dialog.ajax library. Applying this dependency and rebuilding Drupal's cache appears to have fixed the issue. See attached patch.

Remaining tasks

Review the attached patch

User interface changes

API changes

Data model changes

View Details

Problem/Motivation

Need to delete 30 million flags using "Remove Flaggings" in the Module Uninstall page. The delete is very slow and frequent out of memory errors are displayed.

Steps to reproduce

Create a large number of flags. Use "Remove Flaggings" in the Module Uninstall page to remove the flags

Proposed resolution

Each flag entity delete calls hook flag\_entity\_predelete and then it finds the related flag entity in the storage and deletes it. This step is unnecessary when a flagging entity is deleted. Add a condition to check before proceeding the find the related entities.

Remaining tasks

NIL

User interface changes

NIL

API changes

NIL

Data model changes

NIL

View Details

This module is still using old README.md template format in README.md file.

Follow the pattern in the README.md template.

View Details

Problem/Motivation

I have a content type article, which can be flagged by anonymous users. I have a view of those articles (only 3 there) on main page and after the clearing the cache website is awfully slow.

I tracked down the problem using the webprofiler down to flag module and a query:

SELECT "flagging\_node\_field\_data\_\_flag\_counts"."count" AS "flagging\_node\_field\_data\_\_flag\_counts\_count", "node\_field\_data"."created" AS "node\_field\_data\_created", MIN(node\_field\_data.nid) AS "nid", MIN(flagging\_node\_field\_data.id) AS "flagging\_node\_field\_data\_id" FROM "node\_field\_data" "node\_field\_data" LEFT JOIN "flagging" "flagging\_node\_field\_data" ON node\_field\_data.nid = flagging\_node\_field\_data.entity\_id AND flagging\_node\_field\_data.flag\_id = 'like' LEFT JOIN "flag\_counts" "flagging\_node\_field\_data\_\_flag\_counts" ON flagging\_node\_field\_data.flag\_id = flagging\_node\_field\_data\_\_flag\_counts.flag\_id AND flagging\_node\_field\_data\_\_flag\_counts.entity\_id = flagging\_node\_field\_data.entity\_id INNER JOIN "node" "node" ON node\_field\_data.nid = node.nid WHERE ("node\_field\_data"."status" = '1') AND ("node\_field\_data"."type" IN ('article')) GROUP BY node.nid, flagging\_node\_field\_data\_\_flag\_counts\_count, node\_field\_data\_created ORDER BY "node\_field\_data\_created" DESC LIMIT 3 OFFSET 0

Which takes more than 11 seconds to execute. This is probably coming from a view which flag count field but there are only 3 articles shown in the view.

The problem is even worse in /blog subpage, where there are 5 views blocks all containing flag counts, loading there takes more than 45 seconds.

The only upside is that caching is saving this up. So only the first load of the day is slow and after that website runs smooth.

I tried to implement patches from similar issues in other threads here in issue threads but sadly it did not work and problem is still there.

View Details

Problem/Motivation

Anonymous users cannot see flagged items in a view.

Steps to reproduce

Create a global flag and add it to a content type.
Create a view listing the content type.
When an anonymous user flags 3 nodes on the view page, everything seams ok.
If user reloads the page, only one node seams to be flagged.

The cookie that holds all flagged items has the correct values,
however the js function Drupal.flagAnonymousLinkTemplates splits the cookie value by '+'.
It should be spited by ' ';

Attached patch solves the issue.

View Details

Problem/Motivation We have a view that uses Search_API SOLR with content that uses the flag field, when it is indexed on save an error is triggered.

``` RuntimeException while trying to render item entity:node/19:en with view mode full for search index default: Failed to start the session because headers have already been sent by "/var/www/html/vendor/symfony/http-foundation/Response.php" at line 384. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 152 of /var/www/html/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php).

```

After debug it I saw that the hook flag_views_query_substitutions is triggered, and the code from FlagService::getAnonymousSessionId triggered the error.

$request->getSession()->get('flag.session_id')

Why is it necessary the query substitution for flag session? I saw that is used on the plugin https://git.drupalcode.org/project/flag/-/blob/8.x-4.x/src/Plugin/views/... but I do not understand if it is relevant.

``` $flag_roles = user_roles(FALSE, "flag " . $flag->id()); if (isset($flag_roles[RoleInterface::ANONYMOUS_ID]) && $this->currentUser->isAnonymous()) { // Disable page caching for anonymous users. $this->pageCacheKillSwitch->trigger();

    // Add a condition to the join on the PHP session id for anonymous users.
    $this->definition['extra'][] = [
      'field' => 'session_id',
      'value' => '***FLAG_CURRENT_USER_SID***',
    ];
  }

``` Steps to reproduce * Create new content with a flag field. * Index it on a search_api view * The error will appear on the log

Proposed resolution Check that the session is already started on method FlagService::getAnonymousSessionId()

``` $session_id = $request->hasSession() && $request->getSession()->isStarted() ? $request->getSession()->get('flag.session_id') : NULL;

```

View Details

Problem/Motivation Flag prevents deleting any entity.

Steps to reproduce Once flag is enabled, any attempt to delete an entity will result in error:

``` TypeError: Argument 1 passed to Drupal\Core\Entity\Sql\DefaultTableMapping::requiresDedicatedTableStorage() must implement interface Drupal\Core\Field\FieldStorageDefinitionInterface, null given, called in /external/src/web/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php on line 331 en Drupal\Core\Entity\Sql\DefaultTableMapping->requiresDedicatedTableStorage() (lĂ­nea 521 de /external/src/web/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php)

0 /external/src/web/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php(331): Drupal\Core\Entity\Sql\DefaultTableMapping->requiresDedicatedTableStorage(NULL)

1 /external/src/web/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php(468): Drupal\Core\Entity\Sql\DefaultTableMapping->getAllColumns('flagging')

2 /external/src/web/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php(217): Drupal\Core\Entity\Query\Sql\Tables->getTableMapping('flagging', 'flagging')

3 /external/src/web/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php(51): Drupal\Core\Entity\Query\Sql\Tables->addField('entity_type', 'INNER', NULL)

4 /external/src/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(176): Drupal\Core\Entity\Query\Sql\Condition->compile(Object(Drupal\mysql\Driver\Database\mysql\Select))

5 /external/src/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(80): Drupal\Core\Entity\Query\Sql\Query->compile()

6 /external/src/web/modules/contrib/flag/src/FlagService.php(370): Drupal\Core\Entity\Query\Sql\Query->execute()

7 /external/src/web/modules/contrib/flag/flag.module(527): Drupal\flag\FlagService->unflagAllByEntity(Object(Drupal\dexp_layerslider\Entity\Slider))

8 [internal function]: flag_entity_predelete(Object(Drupal\dexp_layerslider\Entity\Slider))

(...)

```

View Details

I am getting this error below after I click the "Add action" button.

Notice: Undefined index: triggers in flag_flag->get_valid_actions() (line 1293 of /home/abc/public_html/sites/all/modules/flag/includes/flag/flag_flag.inc).

Warning: in_array() expects parameter 2 to be array, null given in flag_flag->get_valid_actions() (line 1293 of /home/abc/public_html/sites/all/modules/flag/includes/flag/flag_flag.inc).

View Details

Problem/Motivation When using the reset option to remove all "flaggings" created for a particular flag, I am getting the following PHP type error:

TypeError: Argument 1 passed to Drupal\flag\FlagCountManager::resetLoadedCounts() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /var/www/html/web/modules/contrib/flag/src/FlagCountManager.php on line 246 in Drupal\flag\FlagCountManager->resetLoadedCounts() (line 313 of /var/www/html/web/modules/contrib/flag/src/FlagCountManager.php)

I believe this error occurs when the resetLoadedCounts() method attempts to process an orphaned flag, where the related flaggable entity has been deleted.

Steps to reproduce 1. Create a flag. 2. Flag an entity with the flag. 3. Delete the flagged entity. 4. Use the Reset feature provided for the flag to delete all "flaggings" created for the flag.

Proposed resolution Check to ensure the parent entity exists before attempting to call the resetLoadedCounts() method, which requires a valid entity object.

Remaining tasks Create a patch to address this issue.

User interface changes API changes Data model changes

View Details

I have 2 roles on my site, roleA will post a job, roleB will flag the job node for application, once roleB flagged, roleA will have a views to see who had flagged his node, am wondering if there is a way for roleB to attach a message when flag the job node, so roleA can see who has flagged and the message from the flagers ? Thanks

View Details

Problem/Motivation I am using Flag 8.x-4.0-beta3 in Drupal 9.46 with PHP 7.416

I am looking to upgrade my hosting ASAP to PHP 8.x but as a test on my local development site I've updated (highest I can go locally) to PHP 8.1.0.

When I do so I see the following errors from the Flag module...

Deprecated function: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in Drupal\Core\Access\RouteProcessorCsrf->processOutbound() (line 41 of core\lib\Drupal\Core\Access\RouteProcessorCsrf.php). Drupal\Core\Access\RouteProcessorCsrf->processOutbound('flag.action_link_flag', Object, Array, Object) (Line: 52) Drupal\Core\RouteProcessor\RouteProcessorManager->processOutbound('flag.action_link_flag', Object, Array, Object) (Line: 404) Drupal\Core\Routing\UrlGenerator->processRoute('flag.action_link_flag', Object, Array, Object) (Line: 291) Drupal\Core\Routing\UrlGenerator->generateFromRoute('flag.action_link_flag', Array, Array, 1) (Line: 105) Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('flag.action_link_flag', Array, Array, 1) (Line: 765) I cannot see any obvious discussions RE Flag and PHP 8.x and of course I do realise that the module is only in Beta and therefore not strictly to be used but it is a key player on ours (and I'm sure many other sites) so I wanted to ask about this here in the forum.

Thankyou

View Details

I have a views for listing the fields of user profile(profile2), also I have setup a "user flag" . the views has relationship of "(User) Flags:" , the user profile is duplicated in views whenever there are more than 1 flag for this user, I had the same problem with the 8.x version before, it was solved by turn the aggregation on, but this time doesn't work on 7.x. below is my exported views, please advise. thank you

$view = new view();

$view->name = 'business_profile';

$view->description = '';

$view->tag = 'default';

$view->base_table = 'profile';

$view->human_name = 'business profile';

$view->core = 7;

$view->api_version = '3.0';

$view->disabled = FALSE; / Edit this to true to make a default view disabled initially /

/ Display: Master /

$handler = $view->new_display('default', 'Master', 'default');

$handler->display->display_options['use_more_always'] = FALSE;

$handler->display->display_options['access']['type'] = 'none';

$handler->display->display_options['cache']['type'] = 'none';

$handler->display->display_options['query']['type'] = 'views_query';

$handler->display->display_options['exposed_form']['type'] = 'basic';

$handler->display->display_options['pager']['type'] = 'none';

$handler->display->display_options['pager']['options']['offset'] = '0';

$handler->display->display_options['style_plugin'] = 'default';

$handler->display->display_options['row_plugin'] = 'fields';

$handler->display->display_options['row_options']['inline'] = array(

'field_city_biz_profile' => 'field_city_biz_profile',

'field_us_state' => 'field_us_state',

'field_my_country' => 'field_my_country',

'count' => 'count',

'ops' => 'ops',

);

$handler->display->display_options['row_options']['separator'] = ',';

/ Relationship: Profile: User uid /

$handler->display->display_options['relationships']['user']['id'] = 'user';

$handler->display->display_options['relationships']['user']['table'] = 'profile';

$handler->display->display_options['relationships']['user']['field'] = 'user';

/ Relationship: Flags: user_like /

$handler->display->display_options['relationships']['flag_content_rel']['id'] = 'flag_content_rel';

$handler->display->display_options['relationships']['flag_content_rel']['table'] = 'users';

$handler->display->display_options['relationships']['flag_content_rel']['field'] = 'flag_content_rel';

$handler->display->display_options['relationships']['flag_content_rel']['relationship'] = 'user';

$handler->display->display_options['relationships']['flag_content_rel']['required'] = 0;

$handler->display->display_options['relationships']['flag_content_rel']['flag'] = 'user_like';

$handler->display->display_options['relationships']['flag_content_rel']['user_scope'] = 'any';

/ Field: Profile: Avatar /

$handler->display->display_options['fields']['field_user_avatar']['id'] = 'field_user_avatar';

$handler->display->display_options['fields']['field_user_avatar']['table'] = 'field_data_field_user_avatar';

$handler->display->display_options['fields']['field_user_avatar']['field'] = 'field_user_avatar';

$handler->display->display_options['fields']['field_user_avatar']['label'] = '';

$handler->display->display_options['fields']['field_user_avatar']['element_class'] = 'profilelogobackground';

$handler->display->display_options['fields']['field_user_avatar']['element_label_colon'] = FALSE;

$handler->display->display_options['fields']['field_user_avatar']['click_sort_column'] = 'fid';

$handler->display->display_options['fields']['field_user_avatar']['settings'] = array(

'image_style' => 'profile_200x200',

'image_link' => '',

);

/ Field: Profile: Name /

$handler->display->display_options['fields']['field_business_name_1']['id'] = 'field_business_name_1';

$handler->display->display_options['fields']['field_business_name_1']['table'] = 'field_data_field_business_name';

$handler->display->display_options['fields']['field_business_name_1']['field'] = 'field_business_name';

$handler->display->display_options['fields']['field_business_name_1']['label'] = '';

$handler->display->display_options['fields']['field_business_name_1']['element_type'] = 'h1';

$handler->display->display_options['fields']['field_business_name_1']['element_label_colon'] = FALSE;

/ Field: Profile: City /

$handler->display->display_options['fields']['field_city_biz_profile']['id'] = 'field_city_biz_profile';

$handler->display->display_options['fields']['field_city_biz_profile']['table'] = 'field_data_field_city_biz_profile';

$handler->display->display_options['fields']['field_city_biz_profile']['field'] = 'field_city_biz_profile';

$handler->display->display_options['fields']['field_city_biz_profile']['label'] = '';

$handler->display->display_options['fields']['field_city_biz_profile']['element_type'] = 'span';

$handler->display->display_options['fields']['field_city_biz_profile']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_city_biz_profile']['element_label_class'] = 'fontcolorviews';

$handler->display->display_options['fields']['field_city_biz_profile']['element_label_colon'] = FALSE;

$handler->display->display_options['fields']['field_city_biz_profile']['type'] = 'taxonomy_term_reference_plain';

/ Field: Field: US State /

$handler->display->display_options['fields']['field_us_state']['id'] = 'field_us_state';

$handler->display->display_options['fields']['field_us_state']['table'] = 'field_data_field_us_state';

$handler->display->display_options['fields']['field_us_state']['field'] = 'field_us_state';

$handler->display->display_options['fields']['field_us_state']['label'] = '';

$handler->display->display_options['fields']['field_us_state']['element_type'] = 'span';

$handler->display->display_options['fields']['field_us_state']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_us_state']['element_label_class'] = 'fontcolorviews';

$handler->display->display_options['fields']['field_us_state']['element_label_colon'] = FALSE;

$handler->display->display_options['fields']['field_us_state']['hide_empty'] = TRUE;

$handler->display->display_options['fields']['field_us_state']['type'] = 'taxonomy_term_reference_plain';

/ Field: Profile: Country /

$handler->display->display_options['fields']['field_my_country']['id'] = 'field_my_country';

$handler->display->display_options['fields']['field_my_country']['table'] = 'field_data_field_my_country';

$handler->display->display_options['fields']['field_my_country']['field'] = 'field_my_country';

$handler->display->display_options['fields']['field_my_country']['label'] = '';

$handler->display->display_options['fields']['field_my_country']['element_label_colon'] = FALSE;

$handler->display->display_options['fields']['field_my_country']['type'] = 'taxonomy_term_reference_plain';

/ Field: Profile: Industry /

$handler->display->display_options['fields']['field_profile_company_industries']['id'] = 'field_profile_company_industries';

$handler->display->display_options['fields']['field_profile_company_industries']['table'] = 'field_data_field_profile_company_industries';

$handler->display->display_options['fields']['field_profile_company_industries']['field'] = 'field_profile_company_industries';

$handler->display->display_options['fields']['field_profile_company_industries']['element_type'] = 'span';

$handler->display->display_options['fields']['field_profile_company_industries']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_profile_company_industries']['hide_empty'] = TRUE;

$handler->display->display_options['fields']['field_profile_company_industries']['type'] = 'taxonomy_term_reference_plain';

/ Field: Profile: Specialties /

$handler->display->display_options['fields']['field_business_profile_sector_1']['id'] = 'field_business_profile_sector_1';

$handler->display->display_options['fields']['field_business_profile_sector_1']['table'] = 'field_data_field_business_profile_sector';

$handler->display->display_options['fields']['field_business_profile_sector_1']['field'] = 'field_business_profile_sector';

$handler->display->display_options['fields']['field_business_profile_sector_1']['label'] = 'Sectors';

$handler->display->display_options['fields']['field_business_profile_sector_1']['element_type'] = 'span';

$handler->display->display_options['fields']['field_business_profile_sector_1']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_business_profile_sector_1']['hide_empty'] = TRUE;

$handler->display->display_options['fields']['field_business_profile_sector_1']['type'] = 'taxonomy_term_reference_plain';

$handler->display->display_options['fields']['field_business_profile_sector_1']['delta_limit'] = '3';

$handler->display->display_options['fields']['field_business_profile_sector_1']['delta_offset'] = '0';

/ Field: Profile: Founded /

$handler->display->display_options['fields']['field_founded']['id'] = 'field_founded';

$handler->display->display_options['fields']['field_founded']['table'] = 'field_data_field_founded';

$handler->display->display_options['fields']['field_founded']['field'] = 'field_founded';

$handler->display->display_options['fields']['field_founded']['element_type'] = 'span';

$handler->display->display_options['fields']['field_founded']['element_label_type'] = 'strong';

/ Field: Profile: Employees /

$handler->display->display_options['fields']['field_profile_employees']['id'] = 'field_profile_employees';

$handler->display->display_options['fields']['field_profile_employees']['table'] = 'field_data_field_profile_employees';

$handler->display->display_options['fields']['field_profile_employees']['field'] = 'field_profile_employees';

$handler->display->display_options['fields']['field_profile_employees']['element_type'] = 'span';

$handler->display->display_options['fields']['field_profile_employees']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_profile_employees']['hide_empty'] = TRUE;

$handler->display->display_options['fields']['field_profile_employees']['type'] = 'taxonomy_term_reference_plain';

/ Field: Profile: Avg. hourly rate /

$handler->display->display_options['fields']['field_profile_avg_hourly_rate']['id'] = 'field_profile_avg_hourly_rate';

$handler->display->display_options['fields']['field_profile_avg_hourly_rate']['table'] = 'field_data_field_profile_avg_hourly_rate';

$handler->display->display_options['fields']['field_profile_avg_hourly_rate']['field'] = 'field_profile_avg_hourly_rate';

$handler->display->display_options['fields']['field_profile_avg_hourly_rate']['element_type'] = 'span';

$handler->display->display_options['fields']['field_profile_avg_hourly_rate']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_profile_avg_hourly_rate']['hide_empty'] = TRUE;

$handler->display->display_options['fields']['field_profile_avg_hourly_rate']['type'] = 'taxonomy_term_reference_plain';

/ Field: Profile: Minimum project size /

$handler->display->display_options['fields']['field_profile_minimum_project_si']['id'] = 'field_profile_minimum_project_si';

$handler->display->display_options['fields']['field_profile_minimum_project_si']['table'] = 'field_data_field_profile_minimum_project_si';

$handler->display->display_options['fields']['field_profile_minimum_project_si']['field'] = 'field_profile_minimum_project_si';

$handler->display->display_options['fields']['field_profile_minimum_project_si']['element_type'] = 'span';

$handler->display->display_options['fields']['field_profile_minimum_project_si']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_profile_minimum_project_si']['hide_empty'] = TRUE;

$handler->display->display_options['fields']['field_profile_minimum_project_si']['settings'] = array(

'thousand_separator' => '',

'prefix_suffix' => 1,

);

/ Field: Profile: About /

$handler->display->display_options['fields']['field_business_highlights']['id'] = 'field_business_highlights';

$handler->display->display_options['fields']['field_business_highlights']['table'] = 'field_data_field_business_highlights';

$handler->display->display_options['fields']['field_business_highlights']['field'] = 'field_business_highlights';

$handler->display->display_options['fields']['field_business_highlights']['label'] = '';

$handler->display->display_options['fields']['field_business_highlights']['alter']['max_length'] = '300';

$handler->display->display_options['fields']['field_business_highlights']['alter']['more_link'] = TRUE;

$handler->display->display_options['fields']['field_business_highlights']['alter']['more_link_text'] = 'more';

$handler->display->display_options['fields']['field_business_highlights']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_business_highlights']['element_label_class'] = 'fontcolorviews';

$handler->display->display_options['fields']['field_business_highlights']['element_label_colon'] = FALSE;

$handler->display->display_options['fields']['field_business_highlights']['hide_empty'] = TRUE;

$handler->display->display_options['fields']['field_business_highlights']['type'] = 'jquery_expander';

$handler->display->display_options['fields']['field_business_highlights']['settings'] = array(

'expandText' => '...more',

'expandPrefix' => '',

'slicePoint' => '300',

'collapseTimer' => '',

'userCollapseText' => 'less',

'userCollapsePrefix' => '',

);

/ Field: Profile: Services /

$handler->display->display_options['fields']['field_profile_company_services']['id'] = 'field_profile_company_services';

$handler->display->display_options['fields']['field_profile_company_services']['table'] = 'field_data_field_profile_company_services';

$handler->display->display_options['fields']['field_profile_company_services']['field'] = 'field_profile_company_services';

$handler->display->display_options['fields']['field_profile_company_services']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_profile_company_services']['hide_empty'] = TRUE;

$handler->display->display_options['fields']['field_profile_company_services']['type'] = 'taxonomy_term_reference_plain';

$handler->display->display_options['fields']['field_profile_company_services']['delta_offset'] = '0';

/ Field: Profile: Clients /

$handler->display->display_options['fields']['field_profile_company_clients']['id'] = 'field_profile_company_clients';

$handler->display->display_options['fields']['field_profile_company_clients']['table'] = 'field_data_field_profile_company_clients';

$handler->display->display_options['fields']['field_profile_company_clients']['field'] = 'field_profile_company_clients';

$handler->display->display_options['fields']['field_profile_company_clients']['element_type'] = 'span';

$handler->display->display_options['fields']['field_profile_company_clients']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_profile_company_clients']['hide_empty'] = TRUE;

$handler->display->display_options['fields']['field_profile_company_clients']['type'] = 'taxonomy_term_reference_plain';

$handler->display->display_options['fields']['field_profile_company_clients']['delta_offset'] = '0';

/ Field: Profile: Awards /

$handler->display->display_options['fields']['field_profile_company_awards']['id'] = 'field_profile_company_awards';

$handler->display->display_options['fields']['field_profile_company_awards']['table'] = 'field_data_field_profile_company_awards';

$handler->display->display_options['fields']['field_profile_company_awards']['field'] = 'field_profile_company_awards';

$handler->display->display_options['fields']['field_profile_company_awards']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_profile_company_awards']['hide_empty'] = TRUE;

$handler->display->display_options['fields']['field_profile_company_awards']['delta_offset'] = '0';

/ Field: Profile: Address /

$handler->display->display_options['fields']['field_business_address']['id'] = 'field_business_address';

$handler->display->display_options['fields']['field_business_address']['table'] = 'field_data_field_business_address';

$handler->display->display_options['fields']['field_business_address']['field'] = 'field_business_address';

$handler->display->display_options['fields']['field_business_address']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_business_address']['element_label_class'] = 'fontcolorviews';

$handler->display->display_options['fields']['field_business_address']['hide_empty'] = TRUE;

/ Field: Profile: Phone /

$handler->display->display_options['fields']['field_phone']['id'] = 'field_phone';

$handler->display->display_options['fields']['field_phone']['table'] = 'field_data_field_phone';

$handler->display->display_options['fields']['field_phone']['field'] = 'field_phone';

$handler->display->display_options['fields']['field_phone']['element_type'] = 'span';

$handler->display->display_options['fields']['field_phone']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_phone']['element_label_class'] = 'fontcolorviews';

$handler->display->display_options['fields']['field_phone']['hide_empty'] = TRUE;

$handler->display->display_options['fields']['field_phone']['type'] = 'text_plain';

/ Field: Field: Website /

$handler->display->display_options['fields']['field_business_link_1']['id'] = 'field_business_link_1';

$handler->display->display_options['fields']['field_business_link_1']['table'] = 'field_data_field_business_link';

$handler->display->display_options['fields']['field_business_link_1']['field'] = 'field_business_link';

$handler->display->display_options['fields']['field_business_link_1']['label'] = 'Web';

$handler->display->display_options['fields']['field_business_link_1']['element_type'] = 'span';

$handler->display->display_options['fields']['field_business_link_1']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_business_link_1']['element_label_class'] = 'fontcolorviews';

$handler->display->display_options['fields']['field_business_link_1']['hide_empty'] = TRUE;

$handler->display->display_options['fields']['field_business_link_1']['click_sort_column'] = 'url';

$handler->display->display_options['fields']['field_business_link_1']['type'] = 'link_url';

/ Field: Profile: Social links /

$handler->display->display_options['fields']['field_social_links']['id'] = 'field_social_links';

$handler->display->display_options['fields']['field_social_links']['table'] = 'field_data_field_social_links';

$handler->display->display_options['fields']['field_social_links']['field'] = 'field_social_links';

$handler->display->display_options['fields']['field_social_links']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_social_links']['click_sort_column'] = 'url';

$handler->display->display_options['fields']['field_social_links']['type'] = 'link_url';

$handler->display->display_options['fields']['field_social_links']['settings'] = array(

'custom_title' => '',

);

$handler->display->display_options['fields']['field_social_links']['delta_offset'] = '0';

$handler->display->display_options['fields']['field_social_links']['separator'] = '

';

/ Field: Profile: Work enquiry /

$handler->display->display_options['fields']['field_work_enquiry']['id'] = 'field_work_enquiry';

$handler->display->display_options['fields']['field_work_enquiry']['table'] = 'field_data_field_work_enquiry';

$handler->display->display_options['fields']['field_work_enquiry']['field'] = 'field_work_enquiry';

$handler->display->display_options['fields']['field_work_enquiry']['element_label_type'] = 'strong';

/ Field: Profile: Web references /

$handler->display->display_options['fields']['field_web_references']['id'] = 'field_web_references';

$handler->display->display_options['fields']['field_web_references']['table'] = 'field_data_field_web_references';

$handler->display->display_options['fields']['field_web_references']['field'] = 'field_web_references';

$handler->display->display_options['fields']['field_web_references']['element_label_type'] = 'strong';

$handler->display->display_options['fields']['field_web_references']['click_sort_column'] = 'url';

$handler->display->display_options['fields']['field_web_references']['type'] = 'link_separate';

$handler->display->display_options['fields']['field_web_references']['settings'] = array(

'custom_title' => '',

);

$handler->display->display_options['fields']['field_web_references']['delta_offset'] = '0';

$handler->display->display_options['fields']['field_web_references']['separator'] = '';

/ Field: Profile: Email anonymous /

$handler->display->display_options['fields']['field_profile_email_anonymous']['id'] = 'field_profile_email_anonymous';

$handler->display->display_options['fields']['field_profile_email_anonymous']['table'] = 'field_data_field_profile_email_anonymous';

$handler->display->display_options['fields']['field_profile_email_anonymous']['field'] = 'field_profile_email_anonymous';

$handler->display->display_options['fields']['field_profile_email_anonymous']['label'] = '';

$handler->display->display_options['fields']['field_profile_email_anonymous']['element_label_colon'] = FALSE;

/ Field: Flags: Flag link /

$handler->display->display_options['fields']['ops']['id'] = 'ops';

$handler->display->display_options['fields']['ops']['table'] = 'flagging';

$handler->display->display_options['fields']['ops']['field'] = 'ops';

$handler->display->display_options['fields']['ops']['relationship'] = 'flag_content_rel';

/ Contextual filter: Profile: User uid /

$handler->display->display_options['arguments']['user']['id'] = 'user';

$handler->display->display_options['arguments']['user']['table'] = 'profile';

$handler->display->display_options['arguments']['user']['field'] = 'user';

$handler->display->display_options['arguments']['user']['default_action'] = 'default';

$handler->display->display_options['arguments']['user']['default_argument_type'] = 'user';

$handler->display->display_options['arguments']['user']['default_argument_options']['user'] = FALSE;

$handler->display->display_options['arguments']['user']['summary']['number_of_records'] = '0';

$handler->display->display_options['arguments']['user']['summary']['format'] = 'default_summary';

$handler->display->display_options['arguments']['user']['summary_options']['items_per_page'] = '25';

/ Filter criterion: Profile: Type /

$handler->display->display_options['filters']['type']['id'] = 'type';

$handler->display->display_options['filters']['type']['table'] = 'profile';

$handler->display->display_options['filters']['type']['field'] = 'type';

$handler->display->display_options['filters']['type']['value'] = array(

'main' => 'main',

);

View Details

I am setting up the action to send email to the node author, node is posted by anonymous user, but there is email field in the node. the field token is "[node:field_story_email]" , but I got error message below when I am using this token on the "Recipient"

"Enter a valid email address or use a token e-mail address such as [node:author:mail]."

Is the email field token not supported for the Recipient ?

View Details

I've added two flags in my system and created a view with links to flag/unflag content more easily.

Flag 1: Content Type A, B

Flag 2: Content Type A

After adding relationship so that I can add the flag links fields to the output the flag 2-link for content of type B is rendered falsely - and of course not working.

View Details

It would be handy to have a drush command to set a flag

View Details

Problem/Motivation For a few months no, ALL my flags existing on the website, being node flags or user flags got deleted with no apparent reason. Nothing in the logs or whatsoever. Today I finally found out that when I delete a user on the website and check "Delete the account and its content.", all flags on the website get deleted, even if that user never used a flag or got flagged.

Steps to reproduce 1. Install Flags and create a flag on any entity bundle 2. Create some flags on entities 3. Create a user 4. Delete the newly created user 5. All existing flags in the system are gone

Proposed resolution Preferred behavior: only delete flags the user is related to: delete flags the user self made on enitities and delete flags on the user itself (for user entity bundles).

View Details

Problem/Motivation I want to use the actions provided by this module with Views bulk operations but getting "Cannot load the 'flag' entity with NULL ID" coming from the core/lib/Drupal/Core/Entity/EntityStorageBase.php:295

Steps to reproduce 1. Enable VBO

  1. Create a view

  2. Enable action provided by flag module

Proposed resolution Remaining tasks User interface changes API changes Data model changes

View Details

I just tested the latest version and this module is not usable with Layout Builder. It says bad or missing block.

View Details

Problem/Motivation With enabled cache flags saved in cookies name 'flags' with the SPACE delimiter.

But js split saved flags with PLUS delimiter.

So only the first flag link will be changed on the page if there is the list of nodes.

There is a space separator for reading and updaeting cookie in flag.cookie_storage.inc in FlagNonGlobalCookieStorage class.

View Details

Hi, I see that many bugs have been fixed. This very useful module, is it ready for a production website? will it be ready for Drupal 10 or will it be a blocking element.

Should I install the BETA or the DEV?

Thanks

View Details

Problem/Motivation The most recent release for this module was released 23 September 2016. This module is used by 27K sites. Lots of issues have been fixed and tested

https://www.drupal.org/project/issues/flag?text=&status=14&priorities=Al...

Proposed resolution Create new release of the module

Remaining tasks Thank you in advance!

View Details

Problem/Motivation I have create a new flag action link for my rest API which returns the href of the flagging/unflagging link. When I set the link type in flag to my custom action link it is applied throughout the site and all the flag links are rendered in the same way, which is not required.

Proposed resolution Pass a new parameter in flagLinkBuilder->build for $link_type. If this parameter is present then that particular link type will be returned or else the default one set in flag config.

View Details

Problem/Motivation Inline @var declarations should use the /* / delimiters

Steps to reproduce Proposed resolution Remaining tasks User interface changes API changes Data model changes

View Details

Problem/Motivation Steps to reproduce Proposed resolution Remaining tasks User interface changes API changes Data model changes

View Details

There must be no blank line following an inline comment

Remove that blank line which are not as per coding standard

View Details

Multi-line function declarations must define one parameter per line

View Details

Problem/Motivation Views configurations using the "flagged" field are producing "The site's configuration does not match the associated schema" errors on /admin/reports/status - "Missing schema" is listed as the problem on individual configs.

Steps to reproduce Install and enable config_inspector and visit your Status report page (/admin/reports/status) to see error messages.

Proposed resolution Add schema for views.field.flag_flagged to flag/config/schema/flag.views.schema.yml

Remaining tasks I'll make a patch to add the schema.

User interface changes None.

API changes None.

Data model changes None.

View Details

I have set a message "Thank you" for Flagged message with AJAX link type. I set the permission for anonymous user can only flag the node but no permission for unflag.

After anonymous flag the node, it leaves a blank space there, no" Thank you" message showing on the place. please advise, thank you.

View Details

I am sorry I come from the drupal7 flag which I has been used for many years. I do not see there is flag action setting for the 4.x version ? am I missing something or its not available yet ? I used to send notification email to node author through the flag action. please advise, thank you

View Details

I have a personal flag setup for AUTHENTICATED USER. no problem for authenticated users, but I got the error below when anonymous when they go to the node page. please advise. ( I noticed the problem is only happened when I set the link type to "Count link", if I change to ajax link then the problem gone )

The website encountered an unexpected error. Please try again later.

TypeError: Argument 1 passed to Drupal\flag\TwigExtension\FlagCount::count() must implement interface Drupal\flag\FlagInterface, null given, called in /home/xx/public_html/web/sites/default/files/php/twig/62c74d7e62e5c_flag-count.html.twig_o3BzpAD5mRLvllwl8oGhKAnyG/A5Gd-5PDinRR3LxnxaP8i2DBUcSxPpAS6ewEtqQRXHs.php on line 67 in Drupal\flag\TwigExtension\FlagCount->count() (line 64 of modules/flag/src/TwigExtension/FlagCount.php).

Drupal\flag\TwigExtension\FlagCount->count(NULL, NULL) (Line: 67)

__TwigTemplate_9154b0721101147f4324558e3fceea7b24e25cd62199bb2f377a344aefa8b0d9->doDisplay(Array, Array) (Line: 405)

Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)

Twig\Template->display(Array) (Line: 390)

Twig\Template->render(Array) (Line: 55)

twig_render_template('modules/flag/modules/flag_count/templates/flag-count.html.twig', Array) (Line: 384)

Drupal\Core\Theme\ThemeManager->render('flag_count', Array) (Line: 422)

Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 201)

Drupal\Core\Render\Renderer->render(Array, 1) (Line: 157)

Drupal\Core\Render\Renderer->Drupal\Core\Render{closure}() (Line: 564)

Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 158)

Drupal\Core\Render\Renderer->renderPlain(Array) (Line: 172)

Drupal\Core\Render\Renderer->renderPlaceholder('', Array) (Line: 649)

Drupal\Core\Render\Renderer->replacePlaceholders(Array) (Line: 534)

Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 201)

Drupal\Core\Render\Renderer->render(Array, 1) (Line: 145)

Drupal\Core\Render\Renderer->Drupal\Core\Render{closure}() (Line: 564)

Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 146)

Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 279)

Drupal\Core\Render\HtmlResponseAttachmentsProcessor->renderPlaceholders(Object) (Line: 71)

Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor->processAttachments(Object) (Line: 45)

Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object)

call_user_func(Array, Object, 'kernel.response', Object) (Line: 142)

Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.response') (Line: 191)

Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 179)

Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)

Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)

Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)

Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 191)

Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 128)

Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 82)

Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)

Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)

Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)

Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)

Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

nt.php).

View Details

I enable the "flag count" and "bookmark" module, but on the flags pages, there is only a "bookmark" sample there, I want to know how to use the flag count function, please advise am I missing something ? thanks

View Details

Problem/Motivation The non-javascript fallback link has an empty destination parameter. This mostly only affects integration tests without javascript.

Steps to reproduce Clicking on an AJAX link on any page other than the flagged entity's canonical route with javascript disabled does not redirect back to the original page.

Proposed resolution It looks like there's a missing return statement in AJAXActionLink::getDestination() which could be the culprit. I'll create a patch and test that later today.

View Details

Problem/Motivation There is lots of files need to fixed with coding standards.

Steps to reproduce Run PHPCS on flag module.

Proposed resolution Fixed the coding standards.

Remaining tasks User interface changes API changes Data model changes

View Details

Problem/Motivation If the same flag is deleted by the same user.

Steps to reproduce - One page is open in one tab and the same page is open is other tab.

  • If the user deletes/unflag a flag from one tab. Sometime later the same user tries to delete/unflag the same flag from other tab.

  • The error is shown.

Proposed resolution Right now the code is directly throwing the error instead of handling it.

Use try catch to handle the error.

Remaining tasks User interface changes API changes Data model changes

View Details

Problem/Motivation I was unable to upgrade to Drupal 9 due to an incorrect/missing parameter in flag_admin.info.yml.

Steps to reproduce * Install Flag module on a Drupal 8 project * Try to upgrade to Drupal 9

Proposed resolution Replace the core parameter with core_version_requirement.

View Details

Is there a user field missing, where the user can select the default setting of each activated flag? Additionaly the admin should be able to change the setting for new users.

View Details

Problem First i'm using the latest Drupal 9 version.

Hi, i've started using the flag module recently. Fir my project i need to be able to flag view and pages.

I've looked on the net but cannot seems to find a solution.

Question? Is it possible for the flag module to flag views and pages?

If so, how can i do it?

Thanks everyone for the help If my request is not good or if i can improve it do not hesitate to tell me what to change.

This is my first post on Drupal community.

Thanks again.

View Details

Problem/Motivation A solution to let user add some html in the flag/unflag message

Steps to reproduce Proposed resolution Remaining tasks User interface changes API changes Data model changes

View Details

Problem/Motivation For people just going into the module completely new, the naming of the Flags as "Flag Type" on Flag creation could be interpreted wrong. It should be more properly named something like "Type to flag", since it is only programmatically a flag type, but on the UI we want to specify the entity type to allow flagging on with the current flag.

Steps to reproduce Create a flag

Proposed resolution Change the description and radio header.

View Details

Dear flag maintainers: we're working on a new rules engine for Drupal 9+ and the community has already requested some integration with flag. We could of course do that in a separate eca_flag module, but since the integration is really non-invasive we would love to put that into the flag module directly. If you don't mind, we'd provide a MR for this soon.

View Details

Problem/Motivation On a multilingual site (with English as default) the Flag ajax link produces no effect if Account administration pages on the top of the list in Interface text language detection is enabled.

Steps to reproduce 1. Create a flag on a multilingual site.

  1. Enable the Flag in Ajax mode on Full content view. Flagging / unflagging works as expected.

  2. Now under Regional and language > Languages > Detection and selection, under the Interface text language detection table check the Account administration pages.

  3. Return to full page view of any node. Flagging/unflagging does not work with the Ajax link (neither on the regular node page, nor when the link is provided through a views block).

  4. Uncheck the Account administration pages checkbox, everything works as expected again.

View Details

Problem/Motivation Error with the anonymous user on any entity with a flag enabled.

The error is: Uncaught PHP Exception LogicException: "An anonymous user must be identified by session ID." at ...\web\modules\contrib\flag\src\FlagService.php line 176

This means that the site is completely unusable for anonymous users, as any entity of type "content" produces a WSOD.

Disabling the flags for the entity removes the error.

My current setup is:

Drupal 9.2

Flag 8.x-4.0-beta2

At the moment, the message stack is unusable with this issue.

Is this something to do with this?: https://www.drupal.org/node/3006306

Will updating to dev fix this?

Thanks

Steps to reproduce Browse to any entity page with a flag enabled as anonymous user.

Proposed resolution Remaining tasks User interface changes API changes Data model changes

View Details

Problem/Motivation When deleting a flag that is associated with a flaggable that no longer exists, FlagCountManager will try and pass a NULL item into resetLoadedCounts, which is rejected as a TypeError.

Steps to reproduce Not sure how this cropped up, although I expect it can be reproduced like this:

Create a content type

Create a flag that can be used to flag the content type

Create a content item of the new tyoe

Flag the content item

Delete the content item

Delete the flagging in code; load the flag, call ->delete() on it

Proposed resolution Check whether the flaggable still exists before passing it into resetLoadedCounts().

Remaining tasks Create MR

Review

Commit

User interface changes None

API changes None

Data model changes None

View Details

When you allow a flag to be used by anonymous users (e. g. a bookmark function for blog posts or products) and this is used a lot, the performance can slow down extremely, especially when you have a view rendering the entity teaser showing the users' flag status for each entity/node. In our case the view shows 6 items per page and the DB queries took between 20 and 30 seconds for this page.

I temporarily activated the web profiler and as result got that the query

``` SELECT f.entity_id AS entity_id, f.flag_id AS flag_id, f.global AS global FROM flagging f WHERE (entity_type = :db_condition_placeholder_0) AND (entity_id IN (:db_condition_placeholder_1)) AND ((global = :db_condition_placeholder_2) OR (uid = :db_condition_placeholder_3))

```

took between 2 and 4 seconds for each entity/node. I looked into the flagged table and have seen that it contains approx. 1,300,000 rows. After deleting all row with uid = 0 and created timestamp before 30 days ago and afterwards optimizing the table with still approx. 111,000 rows the sum of all DB queries has reduced to 10 milliseconds.

Proposed resolution Optimize the query and table index entity_id__uid to match. The index currently contains the colums entity_id and uid while the query involves entity_type, entity_id and uid. Because entity_type is not included in the index it requires a full table scan for every single query. Furthermore as the variety of entity_type values is not as big as for the other values (mostly its value is node), adding it as first column to the index does not make so much sense.

Therefore, I suggest changing the order of the WHERE arguments by moving the entity_type down:

``` SELECT f.entity_id AS entity_id, f.flag_id AS flag_id, f.global AS global FROM flagging f WHERE (entity_id IN (:db_condition_placeholder_1)) AND ((uid = :db_condition_placeholder_3) OR (global = :db_condition_placeholder_2)) AND (entity_type = :db_condition_placeholder_0)

```

This way the database first can use the index entity_id__uid and then perform a scan on the filtered result set instead of the whole table.

View Details

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).

View Details

Hi,

I have created AJAX wishlist flag on product list page. i can do only one 'flag' or 'unflag' in AJAX way. i can not flag or unflag multiple times on same product. i am getting error like "TypeError: document.querySelector(...) is null" in console, when i flag or unflag by clicking.

Please help me, Thanks in advance

View Details

Problem/Motivation At present, flaggings cannot be posted or retrieved from jsonapi unless the user has the "Administer flaggings" permission.

This is incorrect behavior because users may have permission to make flaggings/access their own flags, so they shouldn't be automatically denied access.

According to Wim Leers, the Flag module needs to provide a normalizer for rest/jsonapi.

Steps to reproduce 1. Create a flag and have authenticated users flag some content.

  1. Use jsonapi to try to post a flagging while logged in as a non-admin user that has permission to post a flag.

You will get an "access denied" message.

Proposed resolution Add support for POST operations for flags in jsonapi.

Remaining tasks User interface changes API changes Data model changes

View Details

Problem/Motivation The flag theme does not contains any information on the flaggable view mode. This information allows building conditional logic in the theming layer.

Steps to reproduce * Render a flag on a node 'full' display. * Render a flag on a node 'teaser' display. * Notice there is no information available in the twig file or preprocess methods about the flaggable view mode to distinguish between the two.

Proposed resolution Add an additional argument 'view mode' to the flag link builder to enable conditional logic in the theming layer.

Remaining tasks 1. Write a patch 2. Review 3. Commit

User interface changes None.

API changes The flag.link_builder:build lazy builder takes an additional argument 'view_mode'.

Data model changes None.

Original report by gagarine I have a flag in the teaser and full node. Template suggestion do not offer a way to have two different kind of template depending of the view mode of the entity.

I taught about using the flaggable variable aviable in flag.html.twig . Sadly flaggable.view_mode give me nothings. I explored the flaggable variable but didn't find any information about the display mode.

What is the way to do that?

View Details

Problem/Motivation The flagging table can be slow to access for particularly large datasets.

Proposed resolution Create a StorageSchema handler to change the row format of the flagging table and add an index to be equivalent to the following SQL.

ALTER TABLE `flagging` ROW_FORMAT = DYNAMIC ALTER TABLE `flagging` ADD INDEX `flag_id__uid__session_id` ( `flag_id` , `uid` , `session_id` ) Remaining tasks Create patch.

User interface changes None.

API changes None.

Data model changes None.

Original issue We're using the getUserFlagFlagginCount method on the flag.count service. We've got a massive flagging table of +300.000 rows and the method is running massively slow. We've been able to fix this by creating a new table index:

ALTER TABLE `flagging` ROW_FORMAT = DYNAMIC ALTER TABLE `flagging` ADD INDEX `flag_id__uid__session_id` ( `flag_id` , `uid` , `session_id` )

This gave us a massive database performance boost. I've not been able to create a patch for this as we speak, though I just made this into a issue for documentation and patching purposes.

View Details

There are 10 coding standard errors with the message

There must be no blank line following an inline comment.

I am working on this now.

View Details

Hey !

So we got this keyboard navigation bug with flag on some browser.

Step to reproduce :

  1. Navigate to the flag icon / link with tab
  2. Press enter to un/flag the content
  3. The focus is lost after the return of ajax callback

On firefox it's not a big issue, tabbing one more time put the focus back on the icon, but on browsers like Chromium, the focus is sent back to the beginning of the document, which is a big accessibility problem (stopping us from our AA accessibility grade, damn…).

So what I was thinking about was to add a Command after the operation, in Controller/ActionLinkController.php, somewhere like // Create a new JQuery Replace command to update the link display. in order to put the focus back on the element when the replace is over, with maybe a small delay or something else.

I'd really like to solve this issue, every feedback / advice is well appreciated.

Thanks !

View Details

When flags are used as part of a views relationship the resulting query performance slows as more and more flag content is introduced. This issue arouse as part of how the message subscribe module uses flagging on content and provides a way to view all flagged content you have subscribed to.

The following is the query and explain output for before and after the attached patch.

``` EXPLAIN SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM node_field_data node_field_data INNER JOIN flagging flagging_node_field_data ON node_field_data.nid = flagging_node_field_data.flagged_entity__target_id_int AND flagging_node_field_data.flag_id = 'subscribe_node' LEFT JOIN flagging flagging_node_field_data_1 ON node_field_data.nid = flagging_node_field_data_1.flagged_entity__target_id_int AND (flagging_node_field_data_1.flag_id = 'email_node' AND flagging_node_field_data_1.uid = '254') WHERE (( (flagging_node_field_data.uid = '254' ) )) subquery; +----+--------------------+----------------------------+------+----------------------------------------------------------------+--------------------------------+---------+----------------------------------------- | id | select_type | table | type | possible_keys | key | key_len | ref
+----+--------------------+----------------------------+------+----------------------------------------------------------------+--------------------------------+---------+----------------------------------------- | 1 | PRIMARY | | ALL | NULL | NULL | NULL | NULL
| 2 | DERIVED | flagging_node_field_data | ref | flagging_field__uid__target_id | flagging_field__uid__target_id | 4 | const
| 2 | DERIVED | node_field_data | ref | PRIMARY,node__id__default_langcode__langcode,node__status_type | PRIMARY | 4 | community_dev.flagging_node_field_data.f | 2 | DERIVED | flagging_node_field_data_1 | ref | flagging_field__uid__target_id | flagging_field__uid__target_id | 4 | const
| 3 | DEPENDENT SUBQUERY | na | ref | PRIMARY | PRIMARY | 4 | community_dev.node_field_data.nid
+----+--------------------+----------------------------+------+----------------------------------------------------------------+--------------------------------+---------+----------------------------------------- (END)

```

although it is defaulting to an index query times still range from 45-50 seconds for 4800 return values.

After adding an index on uid, flag_id, flagged_entity__target_id_int the average query time is about _.085 seconds_

``` +----+--------------------+----------------------------+------+-----------------------------------------------------------------------------------+----------------------------------------------------+---------+-- | id | select_type | table | type | possible_keys | key | key_len | r +----+--------------------+----------------------------+------+-----------------------------------------------------------------------------------+----------------------------------------------------+---------+-- | 1 | PRIMARY | | ALL | NULL | NULL | NULL | N | 2 | DERIVED | flagging_node_field_data | ref | flagging_field__uid__target_id,flagging_flag_id_uid_flagged_entity__target_id_int | flagging_flag_id_uid_flagged_entity__target_id_int | 770 | c | 2 | DERIVED | node_field_data | ref | PRIMARY,node__id__default_langcode__langcode,node__status_type | PRIMARY | 4 | c | 2 | DERIVED | flagging_node_field_data_1 | ref | flagging_field__uid__target_id,flagging_flag_id_uid_flagged_entity__target_id_int | flagging_flag_id_uid_flagged_entity__target_id_int | 775 | c | 3 | DEPENDENT SUBQUERY | na | ref | PRIMARY | PRIMARY | 4 | c +----+--------------------+----------------------------+------+-----------------------------------------------------------------------------------+----------------------------------------------------+---------+--

```

The performance for the selection of data mimics this performance gain with query times around .11-.13 seconds.

View Details

Hello,

I entered a text in "Unflag not allowed text" but when I flag a node, the flag disappears and nothing is displayed.

View Details

The flag label UI description says:

A short, descriptive title for this flag. It will be used in administrative interfaces to refer to this flag, and in page titles and menu items of some views this module provides (these are customizable, though). Some examples could be Bookmarks, Favorites, or Offensive.

But we're using this in the edit form, which is user-facing.

We either need to make this clear in the UI description, or use something else in the edit form.

We also need to make it clear what you'll get in the edit form, without having to either try it out or crack open the code.

View Details

Problem/Motivation In Flag 7.x-3.x, flag links would appear in the entity links section even if all options under "Display in entity links" were unchecked. In 4.x, flag links do not appear at all.

Proposed resolution Alter the FlagEditForm to provide an explicit "display in node links option".

Implement hook_node_links_alter().

Add tests for display mode functionality.

Remaining tasks Create patch.

User interface changes An explicit "display in node links section" would appear in the FlagEditForm.

API changes Additional options would be available under the NodeFlagType.

Data model changes Additional options would be available for the NodeFlagType plugin.

View Details

Problem/Motivation There are potential use-cases for allowing the flagging of config entities.

In the message_subscribe module, flags are used to denote subscriptions:

  • Subscribe to comments for a node is handled by flagging the individual node
  • Subscribe to all content for a given user or term is handled by flagging the user or term
  • Subscribe to all content of a given type would be handled by flagging the node type

This screenshot from the original IS isn't from message_subscribe, but indicates the same use case:

where announcements and discussions are flagged node types.

Proposed resolution Utilize the Dynamic Entity Reference module for the flagging entity's reference column (now a single flagged_entity base field.)

``` $fields['flagged_entity'] = BaseFieldDefinition::create('dynamic_entity_reference') ->setLabel(t('Flagged entity')) ->setDescription(t('The entity that has been flagged.')) ->setCardinality(1) ->setRequired(TRUE);

```

This replaces the previous 3 base fields on the flagging entity (entity_type, entity_id, and the computed flagged_entity).

Remaining tasks User interface changes API changes Data model changes

View Details

Problem/Motivation We finally have a stable version of Drupal 8! Even after two years of development, however, we still don't have a stable version of Flag. While the dev version is "stable enough" for use, we still do not support upgrades within the 4.x version. Not even having an alpha is a barrier for many users.

Proposed resolution Create an alpha release ASAP, even if it has outstanding criticals, kluges, or regressions. It's an alpha, after all, and this is more about saying "Yes, please use Flag!" than making it perfect.

Remaining tasks * ~~Identify which issues are preventing an alpha release.~~ * ~~Create a Flag alpha release as soon as possible, and begin to support upgrades within the 4.x version.~~ * ~~Work to resolve criticals, major regressions, and missing features during the alpha process.~~ * ~~Release betas when Flag hits zero criticals and zero missing features.~~ * Identify which issues, criteria, load testing, or waiting period need to be resolved before releasing 4.0. * Have some Irish Coffee or something.

User interface changes N/A

API changes N/A

Data model changes N/A

View Details

Problem/Motivation The current implementation of the flags module integration with the rules module can lead to a fatal error under certain situtations. The source of the fatal error is a bad operand to the array_merge function.

The behavior of array_merge() was modified in PHP 5. Unlike PHP 4, array_merge() now only accepts parameters of type array. However, you can use typecasting to merge other types.

One pathway to this error situation is when the module_implements variable becomes incomplete, possibly due to a bad cache flush under heavy load. In these situations sites will stop working properly, but should still bootstrap completely enough to correct the corrupted cache. Under this type of condition, the flag module doesn't do adequate sanity checks leading to the fatal error and incomplete bootstrap. Additional information on cache poisoning can be found in another thread: https://www.drupal.org/node/1934192#comment-7363318

When it tries to load all of the defined flags, it is expecting that it will always get at least the default link types. The issue we are seeing is being caused by flag_get_link_types() returning an empty array. In the corrupted cache situation, the flag.flag.inc file may not get loaded so the hook with the default link types is not run. Since the default link types are loaded via the flag_link_type_info hook, and then modified by the flag_link_type_info alter hook, the Flag module could also get any combination of results due to other poorly written modules. As a result, the $flag->get_link_type() method can return something other than an array (ie. NULL).

Specifically, when the $flag->options() method is called it does the following:

```

get_link_type(); $options = array_merge($options, $link_type['options']); ?>

```

Having a rule defined is not a requirement for this bug to appear, but having a flag defined is. The Flag module tries to interrate over all defined flags to expose them as events to Rules. The problem is simply assuming that the values being assigned both exist and are an array, which, while it's supposed to exist and supposed to be an array, can not simply be expected 100% of the time in a contributed, alterable ecosystem.

Proposed resolution The code is already typecasting the $options variable.

``` $flag_options = (array) $flag->options();

``` Why not the same for the flag options?

``` $link_type = (array) $this->get_link_type();

``` That at least guarantees that when you do a += or array_merge, the values are empty arrays. The argument really isn't that they should never be empty, the argument is handling it better than a fatal error that kills the bootstrap process.

The fact is that in certain edge cases, the options are NULL or empty, which does not play well with += assignment of another type. Typecasting just ensures your data type is what you expect.

Remaining tasks Once something like a simple typecasting casting is added to the code, nothing else needs to happen. All functionality will remain the same. It just removes a potential fatal error condition.

User interface changes None.

API changes None.

Original report by vinoth.3v I am getting Fatal error: Unsupported operand types in flag/includes/flag/flag_flag.inc on line 130

Drupal 7.20

Flag 7.x-3.x-dev and 7.x-3.0-alpha4

any Idea?

View Details

It would be good to add a high z-index to .flag-message, as well as a background color and possibly padding and border. Reason is that if a bookmark is at the edge of a container, the flag message is partially hidden. By adding this CSS it will show on top of the bordering containers.

This is the CSS I have used to override .flag-message:

z-index: 20; background: #ffffff; padding: 0.2em; border: 1px solid #e3e3e3; text-align: left;

View Details

Like several others (http://drupal.org/node/1468334 and http://drupal.org/node/752386), I'm looking for a way to manipulate user-level flags on behalf of other users.

My use-case: I've created a content type for volunteer tasks and users can flag which tasks they're interested in helping with. I've also created a View that provides me with a list of all users who've flagged the different tasks (grouped by task, but not relevant for my question.)

What I'd like to be able to do is unflag users from this administrative view. Based on the two issue posts referenced above, I'm assuming this isn't possible at the present time...

If it isn't possible, I'd like to make this a feature request; there seems to be some interest in it. If it is possible, I'd love some guidance on how to make it work, even in a hack-ish form.

Thanks for the awesome work... this module has been helpful to me in the past in so many ways on so many different projects.