Commit e36b5123 authored by alexpott's avatar alexpott

Issue #2006974 by thedavidmeister, jlbellido: Replace theme() with...

Issue #2006974 by thedavidmeister, jlbellido: Replace theme() with drupal_render() in views_ui().module.
parent 2f872b85
......@@ -76,7 +76,11 @@ public function getQuestion() {
public function getDescription() {
$locked = $this->tempStore->getMetadata($this->entity->id());
$accounts = $this->entityManager->getStorageController('user')->load(array($locked->owner));
return t('By breaking this lock, any unsaved changes made by !user will be lost.', array('!user' => theme('username', array('account' => reset($accounts)))));
$username = array(
'#theme' => 'username',
'#account' => reset($accounts),
);
return t('By breaking this lock, any unsaved changes made by !user will be lost.', array('!user' => drupal_render($username)));
}
/**
......
......@@ -123,10 +123,19 @@ public function form(array $form, array &$form_state) {
$form['#attributes']['class'] = array('form-edit');
if ($view->isLocked()) {
$username = array(
'#theme' => 'username',
'#account' => user_load($view->lock->owner),
);
$lock_message_substitutions = array(
'!user' => drupal_render($username),
'!age' => format_interval(REQUEST_TIME - $view->lock->updated),
'!break' => url('admin/structure/views/view/' . $view->id() . '/break-lock'),
);
$form['locked'] = array(
'#type' => 'container',
'#attributes' => array('class' => array('view-locked', 'messages', 'messages--warning')),
'#children' => t('This view is being edited by user !user, and is therefore locked from editing by others. This lock is !age old. Click here to <a href="!break">break this lock</a>.', array('!user' => theme('username', array('account' => user_load($view->lock->owner))), '!age' => format_interval(REQUEST_TIME - $view->lock->updated), '!break' => url('admin/structure/views/view/' . $view->id() . '/break-lock'))),
'#children' => t('This view is being edited by user !user, and is therefore locked from editing by others. This lock is !age old. Click here to <a href="!break">break this lock</a>.', $lock_message_substitutions),
'#weight' => -10,
);
}
......
......@@ -684,30 +684,28 @@ public function renderPreview($display_id, $args = array()) {
// Assemble the preview, the query info, and the query statistics in the
// requested order.
if ($show_location === 'above') {
$table = array(
'#theme' => 'table',
'#prefix' => '<div class="views-query-info">',
'#suffix' => '</div>',
);
if ($show_location === 'above' || $show_location === 'below') {
if ($combined) {
$output .= '<div class="views-query-info">' . theme('table', array('rows' => array_merge($rows['query'], $rows['statistics']))) . '</div>';
$table['#rows'] = array_merge($rows['query'], $rows['statistics']);
}
else {
$output .= '<div class="views-query-info">' . theme('table', array('rows' => $rows['query'])) . '</div>';
$table['#rows'] = $rows['query'];
}
}
elseif ($show_stats === 'above') {
$output .= '<div class="views-query-info">' . theme('table', array('rows' => $rows['statistics'])) . '</div>';
elseif ($show_stats === 'above' || $show_stats === 'below') {
$table['#rows'] = $rows['statistics'];
}
$output .= $preview;
if ($show_location === 'below') {
if ($combined) {
$output .= '<div class="views-query-info">' . theme('table', array('rows' => array_merge($rows['query'], $rows['statistics']))) . '</div>';
}
else {
$output .= '<div class="views-query-info">' . theme('table', array('rows' => $rows['query'])) . '</div>';
}
if ($show_location === 'above' || $show_stats === 'above') {
$output .= drupal_render($table) . $preview;
}
elseif ($show_stats === 'below') {
$output .= '<div class="views-query-info">' . theme('table', array('rows' => $rows['statistics'])) . '</div>';
elseif ($show_location === 'below' || $show_stats === 'below') {
$output .= $preview . drupal_render($table);
}
_current_path($old_q);
......
......@@ -210,10 +210,18 @@ function theme_views_ui_build_group_filter_form($variables) {
);
$rows[] = array('data' => $data, 'id' => 'views-row-' . $group_id, 'class' => array('draggable'));
}
$table = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('class' => array('views-filter-groups'), 'id' => 'views-filter-groups'))) . drupal_render($form['add_group']);
$table = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
'#attributes' => array(
'class' => array('views-filter-groups'),
'id' => 'views-filter-groups',
),
);
drupal_add_tabledrag('views-filter-groups', 'order', 'sibling', 'weight');
$render_form = drupal_render_children($form);
return $output . $render_form . $table . $more;
return $output . $render_form . drupal_render($table) . drupal_render($form['add_group']) . $more;
}
/**
......@@ -292,12 +300,29 @@ function theme_views_ui_rearrange_filter_form(&$vars) {
if (!empty($ungroupable_rows)) {
drupal_add_tabledrag('views-rearrange-filters-ungroupable', 'order', 'sibling', 'weight');
$header = array(t('Ungroupable filters'), t('Weight'), array('class' => array('views-hide-label'), 'data' => t('Group')), array('class' => array('views-hide-label'), 'data' => t('Remove')));
$output .= theme('table', array('header' => $header, 'rows' => $ungroupable_rows, 'attributes' => array('id' => 'views-rearrange-filters-ungroupable', 'class' => array('arrange'))));
$table = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $ungroupable_rows,
'#attributes' => array(
'id' => 'views-rearrange-filters-ungroupable',
'class' => array('arrange'),
),
);
$output .= drupal_render($table);
}
// Set up tabledrag so that the weights are changed when rows are dragged.
drupal_add_tabledrag('views-rearrange-filters', 'order', 'sibling', 'weight');
$output .= theme('table', array('rows' => $rows, 'attributes' => array('id' => 'views-rearrange-filters', 'class' => array('arrange'))));
$table = array(
'#theme' => 'table',
'#rows' => $rows,
'#attributes' => array(
'id' => 'views-rearrange-filters',
'class' => array('arrange'),
),
);
$output .= drupal_render($table);
$output .= '</div>';
// When JavaScript is enabled, the button for adding a new group should be
......@@ -383,7 +408,12 @@ function theme_views_ui_style_plugin_table($variables) {
// Add the special 'None' row.
$rows[] = array(t('None'), '', '', '', '', '', array('align' => 'center', 'data' => drupal_render($form['default'][-1])), '', '');
$output .= theme('table', array('header' => $header, 'rows' => $rows));
$table = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
);
$output .= drupal_render($table);
$output .= drupal_render_children($form);
return $output;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment