function safeword_entity_by_safeword_settings_form in Safeword 7
Same name and namespace in other branches
- 8 plugins/arguments/entity_by_safeword.inc \safeword_entity_by_safeword_settings_form()
Settings form for the argument.
1 string reference to 'safeword_entity_by_safeword_settings_form'
- entity_by_safeword.inc in plugins/
arguments/ entity_by_safeword.inc - An argument handler to load an entity using a Safeword field.
File
- plugins/
arguments/ entity_by_safeword.inc, line 78 - An argument handler to load an entity using a Safeword field.
Code
function safeword_entity_by_safeword_settings_form(&$form, &$form_state, $conf) {
// List of entity types to check against.
$entity_types = array();
foreach (entity_get_info() as $entity_type => $entity_spec) {
if (!empty($entity_spec['fieldable'])) {
$entity_types[$entity_type] = $entity_spec['label'];
}
}
$form['settings']['entity_type'] = array(
'#title' => t('Entity type to check'),
'#type' => 'radios',
'#options' => $entity_types,
'#required' => TRUE,
'#default_value' => !empty($conf['entity_type']) ? $conf['entity_type'] : array(),
);
// List all Safeword fields, one must be selected.
$fields = array();
foreach (field_info_field_map() as $field_name => $field_spec) {
if (substr($field_spec['type'], 0, 8) == 'safeword') {
$fields[$field_name] = $field_name;
}
}
$form['settings']['field'] = array(
'#title' => t('Field to compare against'),
'#type' => 'radios',
'#options' => $fields,
'#required' => TRUE,
'#default_value' => !empty($conf['field']) ? $conf['field'] : array(),
);
// $form['settings']['breadcrumb'] = array(
// '#title' => t('Inject hierarchy into breadcrumb trail'),
// '#type' => 'checkbox',
// '#default_value' => !empty($conf['breadcrumb']),
// '#description' => t('If checked, taxonomy term parents will appear in the breadcrumb trail.'),
// );
}