Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As #1157660: Flag integration #8 said the fields of flag are listed only one content type on manage display ui, however the flag is added to multiple content type.
This is because of wrong ui limit array on field_info declaration:
foreach (node_type_get_types() as $type) {
$flags = flag_get_flags('node', $type->type);
foreach ($flags as $name => $flag) {
$fields['node']['ds_flag_' . $name] = array(
'title' => t('Flag: ' . $flag->get_label('title')),
'field_type' => DS_FIELD_TYPE_FUNCTION,
'function' => 'ds_extras_flags_add_flag_link',
'properties' => array(
'flag' => $name,
),
'ui_limit' => array($type->type . '|*'), // <-This array always has 1 item.
);
}
}
Now I haven't idea, which would be the best way to collect the correct ui_limit value, but I'll think about it.
Comment | File | Size | Author |
---|---|---|---|
#2 | 1710522-2.patch | 1.57 KB | swentel |
Comments
Comment #1
swentel CreditAttribution: swentel commentedWe should change the logic of creating the fields, instead of
it probably is better to just get all flags, iterate over them and then construct the ui_limit array, given that that info is available in $flag, but I suspect so.
Comment #2
swentel CreditAttribution: swentel commentedFixed, patch attached.
Comment #3
warmth CreditAttribution: warmth commentedSorry for reopening this thread but seems like all is working as expected but Flags on a User Profile page:
#1848282: Can't see the link to flag a user
Comment #4
swentel CreditAttribution: swentel commentedThat's because only user was added here, open a new one as a feature request if you want to expose those too.
Comment #5
warmth CreditAttribution: warmth commentedI guess you didn't read the link I posted... the bug is from built-in user profile!
Comment #6
swentel CreditAttribution: swentel commentedI did, and it's not a bug, it's a feature request and has nothing todo with this issue.
Comment #7
warmth CreditAttribution: warmth commentedUnderstood I will open a new thread so.