Issue #2009008 by pplantinga, InternetDevels, duckx, benjifisher: Replace theme() with drupal_render() in field and field_ui() modules.

8.0.x
Alex Pott 2013-07-24 00:21:55 +02:00
parent 96868e967e
commit 2a1e1472c1
5 changed files with 38 additions and 19 deletions

View File

@ -25,9 +25,10 @@ function theme_field_multiple_value_form($variables) {
$output = '';
if ($element['#cardinality'] > 1 || $element['#cardinality'] == FIELD_CARDINALITY_UNLIMITED) {
$form_required_marker = array('#theme' => 'form_required_marker');
$required = !empty($element['#required']) ? drupal_render($form_required_marker) : '';
$table_id = drupal_html_id($element['#field_name'] . '_values');
$order_class = $element['#field_name'] . '-delta-order';
$required = !empty($element['#required']) ? theme('form_required_marker', $variables) : '';
$header = array(
array(
@ -67,8 +68,17 @@ function theme_field_multiple_value_form($variables) {
);
}
$table = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
'#attributes' => array(
'id' => $table_id,
'class' => array('field-multiple-table'),
),
);
$output = '<div class="form-item">';
$output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => $table_id, 'class' => array('field-multiple-table'))));
$output .= drupal_render($table);
$output .= $element['#description'] ? '<div class="description">' . $element['#description'] . '</div>' : '';
$output .= '<div class="clearfix">' . drupal_render($add_more_button) . '</div>';
$output .= '</div>';

View File

@ -157,7 +157,11 @@ function field_help($path, $arg) {
$items['items'][] = $display;
}
}
$output .= theme('item_list', $items) . '</dd>';
$item_list = array(
'#theme' => 'item_list',
'#items' => $items['items'],
);
$output .= drupal_render($item_list) . '</dd>';
$output .= '<dt>' . t('Managing field data storage') . '</dt>';
$output .= '<dd>' . t('Developers of field modules can either use the default <a href="@sql-store">Field SQL Storage module</a> to store data for their fields, or a contributed or custom module developed using the <a href="@storage-api">field storage API</a>.', array('@storage-api' => 'http://api.drupal.org/api/group/field_storage/8', '@sql-store' => url('admin/help/field_sql_storage'))) . '</dd>';
$output .= '</dl>';

View File

@ -624,12 +624,13 @@ class Field extends FieldPluginBase {
return implode(filter_xss_admin($this->options['separator']), $items);
}
else {
return theme('item_list',
array(
'items' => $items,
'title' => NULL,
'list_type' => $this->options['multi_type'],
));
$item_list = array(
'#theme' => 'item_list',
'#items' => $items,
'#title' => NULL,
'#list_type' => $this->options['multi_type'],
);
return drupal_render($item_list);
}
}
}

View File

@ -355,19 +355,19 @@ function field_ui_view_mode_delete(EntityViewModeInterface $view_mode) {
*/
function theme_field_ui_table($variables) {
$elements = $variables['elements'];
$table = array();
$table = array('#theme' => 'table');
// Add table headers and attributes.
foreach (array('header', 'attributes') as $key) {
if (isset($elements["#$key"])) {
$table[$key] = $elements["#$key"];
foreach (array('#header', '#attributes') as $key) {
if (isset($elements[$key])) {
$table[$key] = $elements[$key];
}
}
// Determine the colspan to use for region rows, by checking the number of
// columns in the headers.
$columns_count = 0;
foreach ($table['header'] as $header) {
foreach ($table['#header'] as $header) {
$columns_count += (is_array($header) && isset($header['colspan']) ? $header['colspan'] : 1);
}
@ -377,7 +377,7 @@ function theme_field_ui_table($variables) {
// Add region rows.
if (isset($region['title']) && empty($region['invisible'])) {
$table['rows'][] = array(
$table['#rows'][] = array(
'class' => array('region-title', 'region-' . $region_name_class . '-title'),
'no_striping' => TRUE,
'data' => array(
@ -387,7 +387,7 @@ function theme_field_ui_table($variables) {
}
if (isset($region['message'])) {
$class = (empty($region['rows_order']) ? 'region-empty' : 'region-populated');
$table['rows'][] = array(
$table['#rows'][] = array(
'class' => array('region-message', 'region-' . $region_name_class . '-message', $class),
'no_striping' => TRUE,
'data' => array(
@ -417,10 +417,10 @@ function theme_field_ui_table($variables) {
$row['data'][] = $cell;
}
}
$table['rows'][] = $row;
$table['#rows'][] = $row;
}
}
return theme('table', $table);
return drupal_render($table);
}

View File

@ -180,7 +180,11 @@ abstract class OverviewBase implements FormInterface, ControllerInterface {
if ($depth = count($parents[$name])) {
$children = element_children($row);
$cell = current($children);
$row[$cell]['#prefix'] = theme('indentation', array('size' => $depth)) . (isset($row[$cell]['#prefix']) ? $row[$cell]['#prefix'] : '');
$indentation = array(
'#theme' => 'indentation',
'#size' => $depth,
);
$row[$cell]['#prefix'] = drupal_render($indentation) . (isset($row[$cell]['#prefix']) ? $row[$cell]['#prefix'] : '');
}
// Add row id and associate JS settings.