function simplemeta_meta_form in Simple Meta 7
Same name and namespace in other branches
- 6.2 simplemeta.module \simplemeta_meta_form()
SimpleMeta form builder.
3 string references to 'simplemeta_meta_form'
- simplemeta_add in ./
simplemeta.admin.inc - Menu callback for creating new SimpleMeta configurations.
- simplemeta_menu in ./
simplemeta.module - Implements hook_menu().
- simplemeta_page_meta_form in ./
simplemeta.module - On-page SimpleMeta form builder.
File
- ./
simplemeta.module, line 407 - SimpleMeta module.
Code
function simplemeta_meta_form($form, &$form_state, $meta) {
// Let's use _ as prefix to not conflict with other elements.
$form['_meta'] = array(
'#type' => 'value',
'#value' => $meta,
);
if (!isset($meta->path)) {
$form['_path'] = array(
'#type' => 'textfield',
'#title' => t('Path'),
'#description' => t('% may be used as placeholder for system pathes, for example, news/archive/%'),
'#required' => TRUE,
);
}
else {
$form['_path'] = array(
'#type' => 'value',
'#value' => $meta->path,
);
}
if (variable_get('simplemeta_language_enable', FALSE)) {
$form['_language'] = array(
'#type' => 'select',
'#title' => t('Language'),
'#options' => _simplemeta_langauge_list(),
'#default_value' => $meta->language,
);
// Do not allow change language for existing meta.
if (isset($meta->sid)) {
$form['_language']['#disabled'] = TRUE;
$form['_language']['#value'] = $meta->language;
}
}
else {
$form['_language'] = array(
'#type' => 'value',
'#value' => $meta->language,
);
}
$form += simplemeta_get_form_elements($meta);
$form['_buttons'] = array(
'#type' => 'actions',
);
$form['_buttons']['save'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#validate' => array(
'simplemeta_meta_form_validate_save',
),
'#submit' => array(
'simplemeta_meta_form_submit_save',
),
'#attributes' => array(
'class' => array(
'button-save',
),
),
);
if (!empty($meta->sid)) {
$form['_buttons']['delete'] = array(
'#type' => 'link',
'#title' => t('Delete'),
'#href' => 'admin/content/simplemeta/' . $meta->sid . '/delete',
);
}
return $form;
}