diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc
index a46696c..c1c3680 100644
--- a/core/modules/file/file.field.inc
+++ b/core/modules/file/file.field.inc
@@ -750,8 +750,16 @@ function theme_file_widget_multiple($variables) {
drupal_add_tabledrag($table_id, 'order', 'sibling', $weight_class);
- $output = '';
- $output = empty($rows) ? '' : theme('table', array('header' => $headers, 'rows' => $rows, 'attributes' => array('id' => $table_id)));
+ $build = array(
+ '#theme' => 'table',
+ '#header' => $headers,
+ '#rows' => $rows,
+ '#attributes' => array(
+ 'id' => $table_id
+ ),
+ );
+
+ $output = empty($rows) ? '' : drupal_render($build);
$output .= drupal_render_children($element);
return $output;
}
@@ -851,11 +859,20 @@ function theme_file_formatter_table($variables) {
foreach ($variables['items'] as $delta => $item) {
if ($item['display'] && $item['entity']) {
$rows[] = array(
- theme('file_link', array('file' => $item['entity'])),
+ 'data' => array(
+ '#theme' => 'file_link',
+ '#file' => $item['entity']
+ ),
format_size($item['entity']->getSize()),
);
}
}
- return empty($rows) ? '' : theme('table', array('header' => $header, 'rows' => $rows));
+ $build = array(
+ '#theme' => 'table',
+ '#header' => $header,
+ '#rows' => $rows,
+ );
+
+ return empty($rows) ? '' : drupal_render($build);
}
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index f7a7c86..ec94aa8 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -741,7 +741,8 @@ function file_ajax_upload() {
// Invalid request.
drupal_set_message(t('An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (@size) that this server supports.', array('@size' => format_size(file_upload_max_size()))), 'error');
$response = new AjaxResponse();
- return $response->addCommand(new ReplaceCommand(NULL, theme('status_messages')));
+ $build = array('#theme' => 'status_messages');
+ return $response->addCommand(new ReplaceCommand(NULL, drupal_render($build)));
}
list($form, $form_state) = ajax_get_form();
@@ -750,7 +751,8 @@ function file_ajax_upload() {
// Invalid form_build_id.
drupal_set_message(t('An unrecoverable error occurred. Use of this form has expired. Try reloading the page and submitting again.'), 'error');
$response = new AjaxResponse();
- return $response->addCommand(new ReplaceCommand(NULL, theme('status_messages')));
+ $build = array('#theme' => 'status_messages');
+ return $response->addCommand(new ReplaceCommand(NULL, $build));
}
// Get the current element and count the number of files.
@@ -777,7 +779,8 @@ function file_ajax_upload() {
$form['#suffix'] .= '';
}
- $form['#prefix'] .= theme('status_messages');
+ $build = array('#theme' => 'status_messages');
+ $form['#prefix'] .= drupal_render($build);
$output = drupal_render($form);
$js = drupal_add_js();
$settings = drupal_merge_js_settings($js['settings']['data']);
@@ -960,13 +963,16 @@ function file_managed_file_process($element, &$form_state, $form) {
if ($element['#multiple']) {
$element['file_' . $delta]['selected'] = array(
'#type' => 'checkbox',
- '#title' => theme('file_link', array('file' => $file)) . ' ',
+ '#title' => array(
+ '#file_link',
+ '#file' => $file
+ ),
);
}
else {
$element['file_' . $delta]['filename'] = array(
- '#type' => 'markup',
- '#markup' => theme('file_link', array('file' => $file)) . ' ',
+ '#type' => 'file_link',
+ '#file' => $file,
'#weight' => -10,
);
}
@@ -1296,7 +1302,11 @@ function theme_file_link($variables) {
$url = file_create_url($file->getFileUri());
// theme_file_icon() requires a file entity, make sure it gets one.
- $icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));
+ $icon_build = array(
+ '#theme' => 'file_icon',
+ '#file' => $file,
+ '#icon_directory' => $icon_directory,
+ );
// Set options as per anchor format described at
// http://microformats.org/wiki/file-format-examples
@@ -1315,7 +1325,7 @@ function theme_file_link($variables) {
$options['attributes']['title'] = check_plain($file->getFilename());
}
- return '' . $icon . ' ' . l($link_text, $url, $options) . '';
+ return '' . drupal_render($icon_build) . ' ' . l($link_text, $url, $options) . '';
}
/**
diff --git a/core/modules/file/lib/Drupal/file/Plugin/field/widget/FileWidget.php b/core/modules/file/lib/Drupal/file/Plugin/field/widget/FileWidget.php
index 4603288..ce5fac0 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/field/widget/FileWidget.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/field/widget/FileWidget.php
@@ -155,7 +155,12 @@ protected function formMultipleElements(EntityInterface $entity, array $items, $
// field. These are added here so that they may be referenced easily
// through a hook_form_alter().
$elements['#file_upload_title'] = t('Add a new file');
- $elements['#file_upload_description'] = theme('file_upload_help', array('description' => '', 'upload_validators' => $elements[0]['#upload_validators'], 'cardinality' => $cardinality));
+ $elements['#file_upload_description'] = array(
+ '#theme' => 'file_upload_help',
+ '#description' => '',
+ 'upload_validators' => $elements[0]['#upload_validators'],
+ 'cardinality' => $cardinality
+ );
}
return $elements;
@@ -216,7 +221,11 @@ public function formElement(array $items, $delta, array $element, $langcode, arr
$default_fids = $element['#extended'] ? $element['#default_value']['fids'] : $element['#default_value'];
if (empty($default_fids)) {
- $element['#description'] = theme('file_upload_help', array('description' => $element['#description'], 'upload_validators' => $element['#upload_validators'], 'cardinality' => $cardinality));
+ $element['#description'] = array(
+ '#theme' => 'file_upload_help',
+ '#description' => $element['#description'],
+ '#upload_validators' => $element['#upload_validators'],
+ '#cardinality' => $cardinality));
$element['#multiple'] = $cardinality != 1 ? TRUE : FALSE;
if ($cardinality != 1 && $cardinality != -1) {
$element['#element_validate'] = array('file_field_widget_multiple_count_validate');
diff --git a/core/modules/file/lib/Drupal/file/Plugin/views/field/FileMime.php b/core/modules/file/lib/Drupal/file/Plugin/views/field/FileMime.php
index a63c2d6..9467f54 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/views/field/FileMime.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/views/field/FileMime.php
@@ -37,7 +37,10 @@ function render($values) {
$data = $values->{$this->field_alias};
if (!empty($this->options['filemime_image']) && $data !== NULL && $data !== '') {
$fake_file = (object) array('filemime' => $data);
- $data = theme('file_icon', array('file' => $fake_file));
+ $data = array(
+ '#theme' => 'file_icon',
+ '#file' => $fake_file
+ );
}
return $this->render_link($data, $values);