You are here

function flag_user::options_form in Flag 7.2

Same name and namespace in other branches
  1. 5 flag.inc \flag_user::options_form()
  2. 6.2 flag.inc \flag_user::options_form()
  3. 6 flag.inc \flag_user::options_form()
  4. 7.3 includes/flag/flag_user.inc \flag_user::options_form()

Options form extras for user flags.

Overrides flag_entity::options_form

File

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

Class

flag_user
Implements a user flag.

Code

function options_form(&$form) {
  parent::options_form($form);
  $form['access']['types'] = array(
    // A user flag doesn't support node types.
    // TODO: Maybe support roles instead of node types.
    '#type' => 'value',
    '#value' => array(
      0 => 0,
    ),
  );
  $form['access']['access_uid'] = array(
    '#type' => 'checkbox',
    '#title' => t('Users may flag themselves'),
    '#description' => t('Disabling this option may be useful when setting up a "friend" flag, when a user flagging themself does not make sense.'),
    '#default_value' => $this->access_uid ? 0 : 1,
  );
  $form['display']['show_on_profile'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display link on user profile page'),
    '#description' => t('Show the link formatted as a user profile element.'),
    '#default_value' => $this->show_on_profile,
    '#access' => empty($this->locked['show_on_profile']),
    // Put this above 'show on entity'.
    '#weight' => -1,
  );

  // Explain how 'show on entity' is different.
  $form['display']['show_on_entity']['#description'] = t('Show the link in the same format as on other entities.');
}