Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
|
@ -33,11 +33,11 @@ function template_preprocess_image_style_preview(&$variables) {
|
|||
// Set up original file information.
|
||||
$original_path = \Drupal::config('image.settings')->get('preview_image');
|
||||
$original_image = $image_factory->get($original_path);
|
||||
$variables['original'] = array(
|
||||
$variables['original'] = [
|
||||
'url' => file_url_transform_relative(file_create_url($original_path)),
|
||||
'width' => $original_image->getWidth(),
|
||||
'height' => $original_image->getHeight(),
|
||||
);
|
||||
];
|
||||
if ($variables['original']['width'] > $variables['original']['height']) {
|
||||
$variables['preview']['original']['width'] = min($variables['original']['width'], $sample_width);
|
||||
$variables['preview']['original']['height'] = round($variables['preview']['original']['width'] / $variables['original']['width'] * $variables['original']['height']);
|
||||
|
@ -54,11 +54,11 @@ function template_preprocess_image_style_preview(&$variables) {
|
|||
$style->createDerivative($original_path, $preview_file);
|
||||
}
|
||||
$preview_image = $image_factory->get($preview_file);
|
||||
$variables['derivative'] = array(
|
||||
$variables['derivative'] = [
|
||||
'url' => file_url_transform_relative(file_create_url($preview_file)),
|
||||
'width' => $preview_image->getWidth(),
|
||||
'height' => $preview_image->getHeight(),
|
||||
);
|
||||
];
|
||||
if ($variables['derivative']['width'] > $variables['derivative']['height']) {
|
||||
$variables['preview']['derivative']['width'] = min($variables['derivative']['width'], $sample_width);
|
||||
$variables['preview']['derivative']['height'] = round($variables['preview']['derivative']['width'] / $variables['derivative']['width'] * $variables['derivative']['height']);
|
||||
|
@ -69,31 +69,31 @@ function template_preprocess_image_style_preview(&$variables) {
|
|||
}
|
||||
|
||||
// Build the preview of the original image.
|
||||
$variables['original']['rendered'] = array(
|
||||
$variables['original']['rendered'] = [
|
||||
'#theme' => 'image',
|
||||
'#uri' => $original_path,
|
||||
'#alt' => t('Sample original image'),
|
||||
'#title' => '',
|
||||
'#attributes' => array(
|
||||
'#attributes' => [
|
||||
'width' => $variables['original']['width'],
|
||||
'height' => $variables['original']['height'],
|
||||
'style' => 'width: ' . $variables['preview']['original']['width'] . 'px; height: ' . $variables['preview']['original']['height'] . 'px;',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
// Build the preview of the image style derivative. Timestamps are added
|
||||
// to prevent caching of images on the client side.
|
||||
$variables['derivative']['rendered'] = array(
|
||||
$variables['derivative']['rendered'] = [
|
||||
'#theme' => 'image',
|
||||
'#uri' => $variables['derivative']['url'] . '?cache_bypass=' . $variables['cache_bypass'],
|
||||
'#alt' => t('Sample modified image'),
|
||||
'#title' => '',
|
||||
'#attributes' => array(
|
||||
'#attributes' => [
|
||||
'width' => $variables['derivative']['width'],
|
||||
'height' => $variables['derivative']['height'],
|
||||
'style' => 'width: ' . $variables['preview']['derivative']['width'] . 'px; height: ' . $variables['preview']['derivative']['height'] . 'px;',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
@ -109,26 +109,26 @@ function template_preprocess_image_style_preview(&$variables) {
|
|||
function template_preprocess_image_anchor(&$variables) {
|
||||
$element = $variables['element'];
|
||||
|
||||
$rows = array();
|
||||
$row = array();
|
||||
$rows = [];
|
||||
$row = [];
|
||||
foreach (Element::children($element) as $n => $key) {
|
||||
$element[$key]['#attributes']['title'] = $element[$key]['#title'];
|
||||
unset($element[$key]['#title']);
|
||||
$row[] = array(
|
||||
$row[] = [
|
||||
'data' => $element[$key],
|
||||
);
|
||||
];
|
||||
if ($n % 3 == 3 - 1) {
|
||||
$rows[] = $row;
|
||||
$row = array();
|
||||
$row = [];
|
||||
}
|
||||
}
|
||||
|
||||
$variables['table'] = array(
|
||||
$variables['table'] = [
|
||||
'#type' => 'table',
|
||||
'#header' => array(),
|
||||
'#header' => [],
|
||||
'#rows' => $rows,
|
||||
'#attributes' => array(
|
||||
'class' => array('image-anchor'),
|
||||
),
|
||||
);
|
||||
'#attributes' => [
|
||||
'class' => ['image-anchor'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
Reference in a new issue