function bueditor_editor_theme in BUEditor 6.2
Same name and namespace in other branches
- 6 bueditor.admin.inc \bueditor_editor_theme()
- 7 admin/bueditor.admin.inc \bueditor_editor_theme()
Editor form theming.
1 string reference to 'bueditor_editor_theme'
- bueditor_theme in ./
bueditor.module - Implementation of hook_theme().
File
- admin/
bueditor.admin.inc, line 282
Code
function bueditor_editor_theme($form = array()) {
$path = drupal_get_path('module', 'bueditor');
$eid = $form['editor']['eid']['#value'];
$header = array(
array(
'data' => t('Title'),
'class' => 'th-title',
),
array(
'data' => t('Content'),
'class' => 'th-content',
),
array(
'data' => t('Icon'),
'class' => 'th-icon',
),
array(
'data' => t('Key'),
'class' => 'th-key',
),
array(
'data' => t('Weight'),
'class' => 'th-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']);
$cells[] = drupal_render($form['buttons'][$bid]['accesskey']);
$cells[] = drupal_render($form['buttons'][$bid]['weight']);
$cells[] = $new ? '<a>new</a>' : drupal_render($form['checks'][$bid]);
$row = array(
'data' => $cells,
'class' => 'draggable',
);
if ($new) {
$row['class'] .= ' new-button';
}
$rows[] = $row;
}
//set title
if ($form['editor']['name']['#value']) {
drupal_set_title(t('Settings for the editor %name', array(
'%name' => $form['editor']['name']['#value'],
)));
}
$name = theme('fieldset', array(
'#title' => t('Editor name'),
'#children' => drupal_render($form['editor']['name']),
'#collapsible' => TRUE,
'#collapsed' => $eid,
));
$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']['spriteon']) . drupal_render($form['editor']['librarypath']),
'#collapsible' => TRUE,
'#collapsed' => $eid,
));
$buttons = theme('table', $header, $rows, array(
'class' => 'button-table',
'id' => 'button-table',
));
$selaction = $eid ? '<div id="sel-action-wrapper">' . drupal_render($form['selaction']) . drupal_render($form['copyto']) . drupal_render($form['go']) . '</div>' : '';
$import = $eid ? theme('fieldset', array(
'#title' => t('Import Buttons'),
'#children' => t('<em>You can either upload a CSV file exported from BUEditor 6.x-1.x or earlier</em> !csvfield <em>OR paste the editor code containing the buttons</em> !codefield', array(
'!csvfield' => drupal_render($form['importcsv']),
'!codefield' => drupal_render($form['importcode']),
)) . drupal_render($form['import']),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
)) : '';
$timer = timer_read('page');
$demo = '';
if ($eid && !isset($_GET['nodemo']) && bueditor_settle($eid)) {
$set['BUE']['preset']['editor-demo'] = "e{$eid}";
$demo = drupal_render($form['demo']);
$set['BUE']['demotime'] = round(timer_read('page') - $timer);
}
$set['BUE']['iconpath'] = bueditor_path_tr($form['editor']['iconpath']['#value']);
$set['BUE']['iconlist'] = bueditor_icons($set['BUE']['iconpath']);
drupal_add_css($path . '/admin/bueditor.edit.css');
drupal_add_js($path . '/admin/bueditor.edit.js');
drupal_add_js($set, 'setting');
drupal_add_tabledrag('button-table', 'order', 'sibling', 'input-weight');
$output = $name . $visibility . $paths;
$output .= '<h2 class="title">' . t('Buttons') . '</h2>' . $buttons . $selaction;
$output .= drupal_render($form['submit']) . $import;
$output .= drupal_render($form) . $demo;
return $output;
}