Commit 52e3eec6 authored by xjm's avatar xjm

Issue #2776975 by joelpittet, dawehner, tim.plunkett, xjm, pfrenssen: March 3,...

Issue #2776975 by joelpittet, dawehner, tim.plunkett, xjm, pfrenssen: March 3, 2017: Convert core to array syntax coding standards for Drupal 8.3.x RC phase
parent 3aba956a

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

...@@ -116,10 +116,10 @@ function authorize_access_allowed(Request $request) { ...@@ -116,10 +116,10 @@ function authorize_access_allowed(Request $request) {
drupal_set_message($results['page_message']['message'], $results['page_message']['type']); drupal_set_message($results['page_message']['message'], $results['page_message']['type']);
} }
$content['authorize_report'] = array( $content['authorize_report'] = [
'#theme' => 'authorize_report', '#theme' => 'authorize_report',
'#messages' => $results['messages'], '#messages' => $results['messages'],
); ];
if (is_array($results['tasks'])) { if (is_array($results['tasks'])) {
$links = $results['tasks']; $links = $results['tasks'];
...@@ -148,11 +148,11 @@ function authorize_access_allowed(Request $request) { ...@@ -148,11 +148,11 @@ function authorize_access_allowed(Request $request) {
]; ];
} }
$content['next_steps'] = array( $content['next_steps'] = [
'#theme' => 'item_list', '#theme' => 'item_list',
'#items' => $links, '#items' => $links,
'#title' => t('Next steps'), '#title' => t('Next steps'),
); ];
} }
// If a batch is running, let it run. // If a batch is running, let it run.
elseif ($request->query->has('batch')) { elseif ($request->query->has('batch')) {
...@@ -189,9 +189,9 @@ function authorize_access_allowed(Request $request) { ...@@ -189,9 +189,9 @@ function authorize_access_allowed(Request $request) {
} }
$bare_html_page_renderer = \Drupal::service('bare_html_page_renderer'); $bare_html_page_renderer = \Drupal::service('bare_html_page_renderer');
$response = $bare_html_page_renderer->renderBarePage($content, $page_title, 'maintenance_page', array( $response = $bare_html_page_renderer->renderBarePage($content, $page_title, 'maintenance_page', [
'#show_messages' => $show_messages, '#show_messages' => $show_messages,
)); ]);
if (!$is_allowed) { if (!$is_allowed) {
$response->setStatusCode(403); $response->setStatusCode(403);
} }
......
...@@ -2103,39 +2103,39 @@ function hook_mail_alter(&$message) { ...@@ -2103,39 +2103,39 @@ function hook_mail_alter(&$message) {
function hook_mail($key, &$message, $params) { function hook_mail($key, &$message, $params) {
$account = $params['account']; $account = $params['account'];
$context = $params['context']; $context = $params['context'];
$variables = array( $variables = [
'%site_name' => \Drupal::config('system.site')->get('name'), '%site_name' => \Drupal::config('system.site')->get('name'),
'%username' => $account->getDisplayName(), '%username' => $account->getDisplayName(),
); ];
if ($context['hook'] == 'taxonomy') { if ($context['hook'] == 'taxonomy') {
$entity = $params['entity']; $entity = $params['entity'];
$vocabulary = Vocabulary::load($entity->id()); $vocabulary = Vocabulary::load($entity->id());
$variables += array( $variables += [
'%term_name' => $entity->name, '%term_name' => $entity->name,
'%term_description' => $entity->description, '%term_description' => $entity->description,
'%term_id' => $entity->id(), '%term_id' => $entity->id(),
'%vocabulary_name' => $vocabulary->label(), '%vocabulary_name' => $vocabulary->label(),
'%vocabulary_description' => $vocabulary->getDescription(), '%vocabulary_description' => $vocabulary->getDescription(),
'%vocabulary_id' => $vocabulary->id(), '%vocabulary_id' => $vocabulary->id(),
); ];
} }
// Node-based variable translation is only available if we have a node. // Node-based variable translation is only available if we have a node.
if (isset($params['node'])) { if (isset($params['node'])) {
/** @var \Drupal\node\NodeInterface $node */ /** @var \Drupal\node\NodeInterface $node */
$node = $params['node']; $node = $params['node'];
$variables += array( $variables += [
'%uid' => $node->getOwnerId(), '%uid' => $node->getOwnerId(),
'%url' => $node->url('canonical', array('absolute' => TRUE)), '%url' => $node->url('canonical', ['absolute' => TRUE]),
'%node_type' => node_get_type_label($node), '%node_type' => node_get_type_label($node),
'%title' => $node->getTitle(), '%title' => $node->getTitle(),
'%teaser' => $node->teaser, '%teaser' => $node->teaser,
'%body' => $node->body, '%body' => $node->body,
); ];
} }
$subject = strtr($context['subject'], $variables); $subject = strtr($context['subject'], $variables);
$body = strtr($context['message'], $variables); $body = strtr($context['message'], $variables);
$message['subject'] .= str_replace(array("\r", "\n"), '', $subject); $message['subject'] .= str_replace(["\r", "\n"], '', $subject);
$message['body'][] = MailFormatHelper::htmlToText($body); $message['body'][] = MailFormatHelper::htmlToText($body);
} }
......
...@@ -50,7 +50,7 @@ function _batch_page(Request $request) { ...@@ -50,7 +50,7 @@ function _batch_page(Request $request) {
// Register database update for the end of processing. // Register database update for the end of processing.
drupal_register_shutdown_function('_batch_shutdown'); drupal_register_shutdown_function('_batch_shutdown');
$build = array(); $build = [];
// Add batch-specific libraries. // Add batch-specific libraries.
foreach ($batch['sets'] as $batch_set) { foreach ($batch['sets'] as $batch_set) {
...@@ -94,7 +94,7 @@ function _batch_do() { ...@@ -94,7 +94,7 @@ function _batch_do() {
// Perform actual processing. // Perform actual processing.
list($percentage, $message, $label) = _batch_process(); list($percentage, $message, $label) = _batch_process();
return new JsonResponse(array('status' => TRUE, 'percentage' => $percentage, 'message' => $message, 'label' => $label)); return new JsonResponse(['status' => TRUE, 'percentage' => $percentage, 'message' => $message, 'label' => $label]);
} }
/** /**
...@@ -130,9 +130,9 @@ function _batch_progress_page() { ...@@ -130,9 +130,9 @@ function _batch_progress_page() {
// it. While this causes invalid HTML, the same would be true if we didn't, // it. While this causes invalid HTML, the same would be true if we didn't,
// as content is not allowed to appear after </html> anyway. // as content is not allowed to appear after </html> anyway.
$bare_html_page_renderer = \Drupal::service('bare_html_page_renderer'); $bare_html_page_renderer = \Drupal::service('bare_html_page_renderer');
$response = $bare_html_page_renderer->renderBarePage(['#markup' => $fallback], $current_set['title'], 'maintenance_page', array( $response = $bare_html_page_renderer->renderBarePage(['#markup' => $fallback], $current_set['title'], 'maintenance_page', [
'#show_messages' => FALSE, '#show_messages' => FALSE,
)); ]);
// Just use the content of the response. // Just use the content of the response.
$fallback = $response->getContent(); $fallback = $response->getContent();
...@@ -159,26 +159,26 @@ function _batch_progress_page() { ...@@ -159,26 +159,26 @@ function _batch_progress_page() {
$url = $batch['url']->toString(TRUE)->getGeneratedUrl(); $url = $batch['url']->toString(TRUE)->getGeneratedUrl();
$build = array( $build = [
'#theme' => 'progress_bar', '#theme' => 'progress_bar',
'#percent' => $percentage, '#percent' => $percentage,
'#message' => array('#markup' => $message), '#message' => ['#markup' => $message],
'#label' => $label, '#label' => $label,
'#attached' => array( '#attached' => [
'html_head' => array( 'html_head' => [
array( [
array( [
// Redirect through a 'Refresh' meta tag if JavaScript is disabled. // Redirect through a 'Refresh' meta tag if JavaScript is disabled.
'#tag' => 'meta', '#tag' => 'meta',
'#noscript' => TRUE, '#noscript' => TRUE,
'#attributes' => array( '#attributes' => [
'http-equiv' => 'Refresh', 'http-equiv' => 'Refresh',
'content' => '0; URL=' . $url, 'content' => '0; URL=' . $url,
), ],
), ],
'batch_progress_meta_refresh', 'batch_progress_meta_refresh',
), ],
), ],
// Adds JavaScript code and settings for clients where JavaScript is enabled. // Adds JavaScript code and settings for clients where JavaScript is enabled.
'drupalSettings' => [ 'drupalSettings' => [
'batch' => [ 'batch' => [
...@@ -187,11 +187,11 @@ function _batch_progress_page() { ...@@ -187,11 +187,11 @@ function _batch_progress_page() {
'uri' => $url, 'uri' => $url,
], ],
], ],
'library' => array( 'library' => [
'core/drupal.batch', 'core/drupal.batch',
), ],
), ],
); ];
return $build; return $build;
} }
...@@ -243,13 +243,13 @@ function _batch_process() { ...@@ -243,13 +243,13 @@ function _batch_process() {
list($callback, $args) = $item