function flag_node::options_form in Flag 7.3
Same name and namespace in other branches
- 5 flag.inc \flag_node::options_form()
- 6.2 flag.inc \flag_node::options_form()
- 6 flag.inc \flag_node::options_form()
- 7.2 flag.inc \flag_node::options_form()
Options form extras for node flags.
Overrides flag_entity::options_form
File
- includes/
flag/ flag_node.inc, line 24 - Contains the flag_node class.
Class
- flag_node
- Implements a node flag.
Code
function options_form(&$form) {
parent::options_form($form);
$form['access']['access_author'] = array(
'#type' => 'radios',
'#title' => t('Flag access by content authorship'),
'#options' => array(
'' => t('No additional restrictions'),
'own' => t('Users may only flag content they own'),
'others' => t('Users may only flag content of others'),
),
'#default_value' => $this->access_author,
'#description' => t("Restrict access to this flag based on the user's ownership of the content. Users must also have access to the flag through the role settings."),
);
// Support for i18n flagging requires Translation helpers module.
$form['i18n'] = array(
'#type' => 'radios',
'#title' => t('Internationalization'),
'#options' => array(
'1' => t('Flag translations of content as a group'),
'0' => t('Flag each translation of content separately'),
),
'#default_value' => $this->i18n,
'#description' => t('Flagging translations as a group effectively allows users to flag the original piece of content regardless of the translation they are viewing. Changing this setting will <strong>not</strong> update content that has been flagged already.'),
'#access' => module_exists('translation_helpers'),
'#weight' => 5,
);
// Override the UI texts for nodes.
$form['display']['show_on_form'] = array(
'#title' => t('Display checkbox on node edit form'),
'#description' => t('If you elect to have a checkbox on the node edit form, you may specify its initial state in the settings form <a href="@content-types-url">for each content type</a>.', array(
'@content-types-url' => url('admin/structure/types'),
)),
) + $form['display']['show_on_form'];
// Add the 'teaser' view mode as a default value for the entity link display
// option if this is a new flag.
if (empty($this->fid)) {
$form['display']['show_in_links']['#default_value']['teaser'] = 'teaser';
}
}