You are here

function flag_entity::options_form in Flag 7.2

Same name and namespace in other branches
  1. 7.3 includes/flag/flag_entity.inc \flag_entity::options_form()

Options form extras for the generic entity flag.

3 calls to flag_entity::options_form()
flag_comment::options_form in ./flag.inc
Options form extras for comment flags.
flag_node::options_form in ./flag.inc
Options form extras for node flags.
flag_user::options_form in ./flag.inc
Options form extras for user flags.
3 methods override flag_entity::options_form()
flag_comment::options_form in ./flag.inc
Options form extras for comment flags.
flag_node::options_form in ./flag.inc
Options form extras for node flags.
flag_user::options_form in ./flag.inc
Options form extras for user flags.

File

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

Class

flag_entity
Base entity flag handler.

Code

function options_form(&$form) {
  $bundles = array();
  $entity_info = entity_get_info($this->content_type);
  foreach ($entity_info['bundles'] as $bundle_key => $bundle) {
    $bundles[$bundle_key] = check_plain($bundle['label']);
  }
  $form['access']['types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Bundles'),
    '#options' => $bundles,
    '#description' => t('Select the bundles that this flag may be used on. Leave blank to allow on all bundles for the entity type.'),
    '#default_value' => $this->types,
  );

  // Handlers may want to unset this option if they provide their own more
  // specific ways to show links.
  $form['display']['show_on_entity'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display link on entity'),
    '#default_value' => isset($this->show_on_entity) ? $this->show_on_entity : TRUE,
    '#access' => empty($this->locked['show_on_entity']),
    '#weight' => 0,
  );
  $form['display']['show_on_form'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display checkbox on entity edit form'),
    '#default_value' => $this->show_on_form,
    '#access' => empty($this->locked['show_on_form']),
    '#weight' => 5,
  );
}