function facebook_publication_type_form in Facebook Autopost 7
Generates the Facebook publication type editing form.
File
- fb_autopost_entity/
fb_autopost_entity.admin.inc, line 26 - Facebook publication type editing UI.
Code
function facebook_publication_type_form($form, &$form_state, $facebook_publication_type, $op = 'edit') {
if ($op == 'clone') {
$facebook_publication_type->label .= ' (cloned)';
$facebook_publication_type->type = '';
}
$form['label'] = array(
'#title' => t('Label'),
'#type' => 'textfield',
'#default_value' => $facebook_publication_type->label,
'#description' => t('The human-readable name of this facebook publication type.'),
'#required' => TRUE,
'#size' => 30,
);
// Machine-readable type name.
$form['type'] = array(
'#type' => 'machine_name',
'#default_value' => isset($facebook_publication_type->type) ? $facebook_publication_type->type : '',
'#maxlength' => 32,
'#disabled' => $facebook_publication_type
->isLocked() && $op != 'clone',
'#machine_name' => array(
'exists' => 'facebook_publication_get_types',
'source' => array(
'label',
),
),
'#description' => t('A unique machine-readable name for this Facebook publication type. It must only contain lowercase letters, numbers, and underscores.'),
);
$form['description'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#description' => t('Write a short description about this Facebook publication type.'),
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save Facebook publication type'),
'#weight' => 40,
);
if (!$facebook_publication_type
->isLocked() && $op != 'add' && $op != 'clone') {
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete Facebook publication type'),
'#weight' => 45,
'#limit_validation_errors' => array(),
'#submit' => array(
'facebook_publication_type_form_submit_delete',
),
);
}
return $form;
}