diff --git a/core/modules/image/image.admin.inc b/core/modules/image/image.admin.inc
index 1cd2155..75071a0 100644
--- a/core/modules/image/image.admin.inc
+++ b/core/modules/image/image.admin.inc
@@ -561,46 +561,47 @@ function theme_image_style_list($variables) {
*/
function theme_image_style_effects($variables) {
$form = $variables['form'];
- $rows = array();
- foreach (element_children($form) as $key) {
- $row = array();
- $form[$key]['weight']['#attributes']['class'] = array('image-effect-order-weight');
- if ($key != 'new') {
- $summary = drupal_render($form[$key]['summary']);
- $row[] = drupal_render($form[$key]['label']) . (empty($summary) ? '' : ' ' . $summary);
- $row[] = drupal_render($form[$key]['weight']);
- $row[] = array('data' => $form[$key]['operations']);
- }
- else {
- // Add the row for adding a new image effect.
- $row[] = '
' . drupal_render($form['new']['new']) . drupal_render($form['new']['add']) . '
';
- $row[] = drupal_render($form['new']['weight']);
- $row[] = '';
- }
+ $table = array(
+ '#type' => 'table',
+ '#header' => array(
+ t('Effect'),
+ t('Weight'),
+ t('Operations'),
+ ),
+ '#tabledrag' => array(
+ array('image-style-effects', 'order', 'sibling', 'image-effect-order-weight'),
+ ),
+ );
- $rows[] = array(
- 'data' => $row,
+ $row_defaults = array(
+ '#attributes' => array(
'class' => array('draggable'),
- );
- }
-
- $header = array(
- t('Effect'),
- t('Weight'),
- t('Operations'),
+ ),
);
- if (count($rows) == 1 && (!isset($form['new']['#access']) || $form['new']['#access'])) {
- array_unshift($rows, array(array(
- 'data' => t('There are currently no effects in this style. Add one by selecting an option below.'),
- 'colspan' => 4,
- )));
+ foreach (element_children($form) as $key) {
+ if ($key != 'new') {
+ $summary = drupal_render($form[$key]['summary']);
+
+ $table[$key] = $row_defaults + array(
+ 'label_summary' => array(
+ '#markup' => drupal_render($form[$key]['label']) . (empty($summary) ? '' : ' ' . $summary),
+ ),
+ 'weight' => $form[$key]['weight'],
+ 'operations' => $form[$key]['operations'],
+ );
+ } else {
+ $table[$key] = $row_defaults + array(
+ 'image_style_new' => array(
+ 'image_style_new_add' => $form[$key]['new'],
+ 'image_style_new_submit' => $form[$key]['add'],
+ ),
+ );
+ }
}
- $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'image-style-effects')));
- drupal_add_tabledrag('image-style-effects', 'order', 'sibling', 'image-effect-order-weight');
- return $output;
+ return drupal_render($table);
}
/**