You are here

function flag_flag::options in Flag 7.2

Same name and namespace in other branches
  1. 6.2 flag.inc \flag_flag::options()
  2. 7.3 includes/flag/flag_flag.inc \flag_flag::options()

Declares the options this flag supports, and their default values.

Derived classes should want to override this.

2 calls to flag_flag::options()
flag_flag::construct in ./flag.inc
Default constructor. Loads the default options.
flag_flag::get_serialized_options in ./flag.inc
Options are stored serialized in the database.

File

./flag.inc, line 235
Implements various flags. Uses object oriented style inspired by that of Views 2.

Class

flag_flag
This abstract class represents a flag, or, in Views 2 terminology, "a handler".

Code

function options() {
  $options = array(
    // The text for the "flag this" link for this flag.
    'flag_short' => '',
    // The description of the "flag this" link.
    'flag_long' => '',
    // Message displayed after flagging content.
    'flag_message' => '',
    // Likewise but for unflagged.
    'unflag_short' => '',
    'unflag_long' => '',
    'unflag_message' => '',
    'unflag_denied_text' => '',
    // The link type used by the flag, as defined in hook_flag_link_types().
    'link_type' => 'toggle',
    'roles' => array(
      'flag' => array(
        DRUPAL_AUTHENTICATED_RID,
      ),
      'unflag' => array(
        DRUPAL_AUTHENTICATED_RID,
      ),
    ),
    'weight' => 0,
  );

  // Merge in options from the current link type.
  $link_type = $this
    ->get_link_type();
  $options = array_merge($options, $link_type['options']);

  // Allow other modules to change the flag options.
  drupal_alter('flag_options', $options, $this);
  return $options;
}