You are here

function bueditor_button_form in BUEditor 6

Same name and namespace in other branches
  1. 6.2 admin/bueditor.admin.inc \bueditor_button_form()
  2. 7 admin/bueditor.admin.inc \bueditor_button_form()

Template form for buttons

1 call to bueditor_button_form()
bueditor_editor_form in ./bueditor.admin.inc
Editor form.

File

./bueditor.admin.inc, line 138

Code

function bueditor_button_form($button = NULL, $icons = array()) {
  $button = (object) ($button ? $button : array(
    'title' => '',
    'content' => '',
    'icon' => '',
    'accesskey' => '',
    'weight' => 0,
  ));
  $form = array();
  $form['title'] = array(
    '#type' => 'textfield',
    '#default_value' => $button->title,
    '#size' => 14,
  );
  $form['content'] = array(
    '#type' => 'textarea',
    '#default_value' => $button->content,
    '#rows' => min(6, max(2, substr_count($button->content, "\n") + 1)),
  );
  $form['icon'] = array(
    '#type' => 'select',
    '#options' => array(
      '' => t('Caption'),
    ) + $icons,
    '#default_value' => $button->icon,
  );
  $form['caption'] = array(
    '#type' => 'textfield',
    '#default_value' => bueditor_isimage($button->icon) ? '' : $button->icon,
    '#size' => 6,
  );
  $form['accesskey'] = array(
    '#type' => 'textfield',
    '#default_value' => $button->accesskey,
    '#size' => 2,
    '#maxlength' => 1,
  );
  $form['weight'] = array(
    '#type' => 'weight',
    '#default_value' => $button->weight ? $button->weight : 0,
  );
  return $form;
}