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.
By phaeton005 on
Hello everyone,
i want to create a flag inside a module 'get_involved'. Unfortunately, despite pretty much copying what drupal.org says (https://www.drupal.org/node/1748148#default-flags), I cannot seem to get flag_default_flags() to work. Any ideas?
Context: I am trying to create a flag within a module, which shall display it in a block.
function get_involved_flag_default_flags() {
$flags = array();
$flags[] = array(
'content_type' => 'node',
'name' => 'get_involved_interested',
'title' => 'Interested',
'global' => FALSE,
'types' => array('ad'),
'flag_short' => 'Join',
'flag_long' => 'I want to join',
'flag_message' => 'Your interest was registered',
'unflag_short' => 'Cancel',
'unflag_long' => 'Cancel my interest',
'unflag_message' => 'Your interest was deleted',
'show_on_page' => TRUE,
'show_on_teaser' => FALSE,
'show_on_form' => TRUE,
'status' => TRUE,
'locked' => array('name', 'types', 'global'),
);
return $flags;
}
Comments
Answer!
I found out that the documentation on this page (https://www.drupal.org/node/1748148) is not the latest.
Instead, I used the following: