function bueditor_editor_theme in BUEditor 6
Same name and namespace in other branches
- 6.2 admin/bueditor.admin.inc \bueditor_editor_theme()
- 7 admin/bueditor.admin.inc \bueditor_editor_theme()
Editor form themed.
1 string reference to 'bueditor_editor_theme'
- bueditor_theme in ./
bueditor.module - Implementation of hook_theme().
File
- ./
bueditor.admin.inc, line 251
Code
function bueditor_editor_theme($form = array()) {
$header = array(
array(
'data' => t('Title'),
'class' => 'btitle',
),
array(
'data' => t('Content'),
'class' => 'content',
),
array(
'data' => t('Icon'),
'class' => 'icon',
),
array(
'data' => t('Key'),
'class' => 'key',
),
array(
'data' => t('Weight'),
'class' => 'weight',
),
theme('table_select_header_cell'),
);
$rows = array();
foreach (element_children($form['buttons']) as $bid) {
$new = !is_numeric($bid);
$cells = array();
$cells[] = drupal_render($form['buttons'][$bid]['title']);
$cells[] = drupal_render($form['buttons'][$bid]['content']);
$cells[] = drupal_render($form['buttons'][$bid]['icon']) . drupal_render($form['buttons'][$bid]['caption']);
$cells[] = drupal_render($form['buttons'][$bid]['accesskey']);
$cells[] = drupal_render($form['buttons'][$bid]['weight']);
$cells[] = $new ? '<a>' . t('new') . '</a>' : drupal_render($form['checks'][$bid]);
$rows[] = $new ? array(
'data' => $cells,
'class' => 'new-button',
'title' => t('Add new button'),
) : $cells;
}
$eid = $form['editor']['eid']['#value'];
$path = drupal_get_path('module', 'bueditor');
drupal_add_css($path . '/admin/admin.css', 'media', 'all', FALSE);
//no preprocessing
drupal_add_js($path . '/admin/admin.js', 'module', 'header', FALSE, TRUE, FALSE);
//no preprocessing
drupal_add_js('var iconPath = "' . base_path() . bueditor_path_tr($form['editor']['iconpath']['#value']) . '"', 'inline');
$help = '<div class="help">' . t('To add a new button, you can either specify it at the bottom of the button list or import a CSV file which contains previously exported buttons. For more information about buttons and editor API please read !readme.', array(
'!readme' => '<a href="' . base_path() . $path . '/README.txt">README.txt</a>',
)) . '</div>';
$buttons = theme('table', $header, $rows, array(
'class' => 'button-table',
'id' => 'button-table',
));
$selaction = '<div class="sel-action">' . drupal_render($form['selaction']) . drupal_render($form['go']) . '</div>';
$visibility = theme('fieldset', array(
'#title' => t('Visibility settings'),
'#children' => drupal_render($form['editor']['pages']) . drupal_render($form['editor']['excludes']),
'#collapsible' => TRUE,
'#collapsed' => $eid,
));
$paths = theme('fieldset', array(
'#title' => t('Editor paths'),
'#children' => drupal_render($form['editor']['iconpath']) . drupal_render($form['editor']['librarypath']),
'#collapsible' => TRUE,
'#collapsed' => $eid,
));
$import = theme('fieldset', array(
'#title' => t('Import Buttons'),
'#children' => drupal_render($form['buecsv']) . drupal_render($form['import']),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
));
$demo = '';
if ($eid && bueditor_settle($eid)) {
drupal_add_js('BUE.preset["editor-demo"] = "e' . $eid . '";', 'inline');
$demo = '<h2 class="title">' . t('Demo') . '</h2><div class="form-item"><textarea cols="60" rows="20" id="editor-demo" class="form-textarea">DEMO</textarea></div>';
}
$output = $help . drupal_render($form['editor']['name']) . ($eid ? '' : $visibility . $paths);
$output .= '<h2 class="title">' . t('Buttons') . '</h2>' . $buttons . $selaction;
$output .= drupal_render($form['submit']) . ($eid ? $visibility . $paths : '');
$output .= $import . drupal_render($form) . $demo;
return $output;
}