function tac_fields_add_form in Taxonomy Access Control 6
Form to choose a field to control with TAC.
@todo Group select options by content type instead of field type?
Return value
Form object.
1 call to tac_fields_add_form()
- theme_tac_fields_admin in tac_fields/
tac_fields.admin.inc - Renders the main admin page (at admin/user/tac_fields).
1 string reference to 'tac_fields_add_form'
- theme_tac_fields_admin in tac_fields/
tac_fields.admin.inc - Renders the main admin page (at admin/user/tac_fields).
File
- tac_fields/
tac_fields.admin.inc, line 134 - Administrative interface for TAC Fields.
Code
function tac_fields_add_form() {
$options = array();
$form = array();
$fields = content_fields();
$controlled_fields = _tac_fields_controlled_fields();
// Assemble a list of all CCK Fields, minus fields we already control.
foreach ($fields as $field) {
if (!in_array($field['field_name'], $controlled_fields)) {
$options[$field['type']][$field['field_name']] = t($field['widget']['label']) . ' (' . $field['field_name'] . ')';
}
}
if (!empty($options)) {
$form['add'] = array(
'#type' => 'select',
'#title' => t('Add field'),
'#required' => TRUE,
'#description' => t('Choose a field to control with TAC Fields.'),
'#options' => $options,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Add'),
);
}
else {
$form['no_choices'] = array(
'#value' => t('There are no fields available that are not already controlled by TAC Fields. See below to configure any fields that are already controlled, or add fields to one of your <a href="@content_types">content types</a>.', array(
'@content_types' => url("admin/content/types"),
)),
);
}
return $form;
}