function smiley_admin_form in Smiley 6
1 string reference to 'smiley_admin_form'
File
- ./
smiley.admin.inc, line 241
Code
function smiley_admin_form($form_state, $edit) {
$form = array();
if ($edit['id']) {
$form['id'] = array(
'#type' => 'hidden',
'#value' => $edit['id'],
);
}
$categories = array(
'Miscellaneous' => 'Miscellaneous',
);
$smileyp = db_query("SELECT DISTINCT package FROM {smiley} ORDER BY package");
while ($pack = db_fetch_object($smileyp)) {
$categories[$pack->package] = $pack->package;
}
ksort($categories);
array_push($categories, '<New Category>');
$form['acronyms'] = array(
'#type' => 'textfield',
'#title' => t('Acronyms'),
'#default_value' => $edit['acronyms'],
'#size' => 16,
'#maxlength' => 255,
'#description' => t('Enter a list of shorthands for the smiley you wish to add, separated by spaces. e.g. \':) ;) :smile:\''),
);
$form['image'] = array(
'#type' => 'textfield',
'#title' => t('Image Path'),
'#default_value' => $edit['image'],
'#size' => 50,
'#maxlength' => 255,
'#description' => t('Enter the relative of the smiley-image relative to the root of your Drupal site. e.g. \'images/smiley/happy.png\'.'),
);
$form['description'] = array(
'#type' => 'textfield',
'#title' => t('Description'),
'#default_value' => $edit['description'],
'#size' => 50,
'#maxlength' => 64,
'#description' => t('A short description of the emotion depicted to be used as tooltip for the image. e.g. \'Laughing out loud\'.'),
);
$form['category'] = array(
'#prefix' => '<div class="container-inline">',
'#type' => 'select',
'#title' => t('Category'),
'#default_value' => $edit['package'],
'#options' => array_unique($categories),
);
$form['category_other'] = array(
'#suffix' => '</div>',
'#type' => 'textfield',
'#default_value' => t('Enter new category here'),
'#size' => 20,
);
$form['weight'] = array(
'#type' => 'weight',
'#title' => t('Weight'),
'#default_value' => $edit['weight'] ? $edit['weight'] : 0,
);
$form['standalone'] = array(
'#type' => 'checkbox',
'#title' => t('Stand-alone'),
'#default_value' => $edit['standalone'],
'#description' => t('When checked, the smiley will only be inserted when an acronym is found as a separate word. This is useful for preventing accidental smiley with short acronyms.'),
);
$form['promote_to_box'] = array(
'#type' => 'radios',
'#title' => t('Visibility'),
'#default_value' => $edit['promote_to_box'],
'#options' => array(
'0' => t('Visible on only on popup i.e. "More Smileys"'),
'1' => t('Visible on select box + popup'),
'-1' => t('Invisible (but not disabled)'),
),
'#description' => t('When checked, the smiley will be shown on the <em>Smiley Select Box</em> in node and comment forms. Unchecked Smileys will be usable only in "<em>more...</em>" pop-up widget.'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
if ($edit['id']) {
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#submit' => array(
'smiley_admin_form_delete',
),
);
}
return $form;
}