Skip to content
Snippets Groups Projects

Issue #3285448: Fix: phpcs --standard=Drupal issues.

Files
15
+ 36
36
@@ -9,8 +9,8 @@
use Drupal\Component\Utility\Html;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Link;
use Drupal\Core\Url;
use \Drupal\Core\Link;
require_once dirname(__FILE__) . '/fortytwo_admin.inc';
@@ -18,7 +18,7 @@ require_once dirname(__FILE__) . '/fortytwo_admin.inc';
* Implements hook_preprocess_html().
*/
function fortytwo_admin_preprocess_html(array &$variables) {
/* @var $user Drupal\Core\Session\AccountProxy */
/** @var Drupal\Core\Session\AccountProxy $user */
$user = $variables['user'];
// Setup the theme basics.
@@ -27,7 +27,7 @@ function fortytwo_admin_preprocess_html(array &$variables) {
$variables['fortytwo_admin_layout_login'] = theme_get_setting('fortytwo_admin_layout_login');
if (!empty($variables['fortytwo_admin_layout_login']) && $user->isAnonymous()) {
if (!isset($variables['attributes']['class'])) {
$variables['attributes']['class'] = array();
$variables['attributes']['class'] = [];
}
$variables['attributes']['class'][] = 'ft-layout-login';
@@ -35,16 +35,16 @@ function fortytwo_admin_preprocess_html(array &$variables) {
$current_path = str_replace('/', '-', substr($current_path, 1));
$variables['attributes']['class'][] = $current_path;
$url = Url::fromUri('https://www.flickr.com/photos/meddygarnet/', array('attributes' => array('target' => '_blank')));
$url = Url::fromUri('https://www.flickr.com/photos/meddygarnet/', ['attributes' => ['target' => '_blank']]);
$name = Link::fromTextAndUrl('Morgan', $url);
$url = Url::fromUri('https://www.flickr.com/photos/meddygarnet/5760264604', array('attributes' => array('target' => '_blank')));
$url = Url::fromUri('https://www.flickr.com/photos/meddygarnet/5760264604', ['attributes' => ['target' => '_blank']]);
$flickr = Link::fromTextAndUrl('flickr', $url);
$variables['page']['fortytwo_admin_credit'] = (string) t('The background image is created by %name and can be downloaded from %flickr', array(
$variables['page']['fortytwo_admin_credit'] = (string) t('The background image is created by %name and can be downloaded from %flickr', [
'%name' => $name->toString(),
'%flickr' => $flickr->toString(),
));
]);
}
$color_profile = theme_get_setting('fortytwo_admin_color_profile');
@@ -86,19 +86,19 @@ function fortytwo_admin_preprocess_html(array &$variables) {
// Change the mime type of the favicon to make it work in all browsers.
$favicon = theme_get_setting('favicon');
$type = 'image/x-icon';
$variables['#attached']['html_head_link'][] = array(
array(
$variables['#attached']['html_head_link'][] = [
[
'rel' => 'shortcut icon',
'href' => $favicon['url'],
'type' => $type,
),
);
],
];
}
/**
* Implements hook_preprocess_block().
*
* Clean up the div classes for blocks
* Clean up the div classes for blocks.
*/
function fortytwo_admin_preprocess_block(array &$variables) {
// Replace first occurance of block- to clean up the ID's.
@@ -177,9 +177,9 @@ function fortytwo_admin_preprocess_breadcrumb(&$variables) {
->getTitle($request, $route_match->getRouteObject());
if (!empty($page_title)) {
$breadcrumb[] = array(
$breadcrumb[] = [
'text' => $page_title,
);
];
}
}
}
@@ -199,32 +199,32 @@ function fortytwo_admin_page_attachments_alter(&$variables) {
$maximum_scale = theme_get_setting('fortytwo_admin_viewport_maximum_scale');
$content = "width=device-width, initial-scale=" . $initial_scale . ", minimum-scale=" . $minimum_scale . ", maximum-scale=" . $maximum_scale . ", user-scalable=" . $user_scalable;
$element = array(
array(
$element = [
[
'#tag' => 'meta',
'#attributes' => array(
'#attributes' => [
'name' => 'viewport',
'content' => $content,
),
),
],
],
'viewport',
);
];
$variables['#attached']['html_head'][] = $element;
}
// Add cleartype.
$cleartype = theme_get_setting('fortytwo_admin_cleartype');
if (!empty($cleartype)) {
$element = array(
array(
$element = [
[
'#tag' => 'meta',
'#attributes' => array(
'#attributes' => [
'name' => 'http-equiv',
'content' => 'on',
),
),
],
],
'cleartype',
);
];
$variables['#attached']['html_head'][] = $element;
}
@@ -239,14 +239,14 @@ function fortytwo_admin_form_alter(&$form, FormStateInterface $form_state, $form
switch ($form_id) {
case 'user_login_form':
$form['name']['#title_display'] = 'invisible';
$form['name']['#attributes'] = array(
$form['name']['#attributes'] = [
'placeholder' => $form['name']['#title']->render(),
);
];
unset($form['name']['#description']);
$form['pass']['#title_display'] = 'invisible';
$form['pass']['#attributes'] = array(
$form['pass']['#attributes'] = [
'placeholder' => $form['pass']['#title']->render(),
);
];
unset($form['pass']['#description']);
break;
@@ -254,21 +254,21 @@ function fortytwo_admin_form_alter(&$form, FormStateInterface $form_state, $form
$form['mail']['#prefix'] = '<p class="description">';
$form['name']['#title_display'] = 'invisible';
$form['name']['#attributes'] = array(
$form['name']['#attributes'] = [
'placeholder' => $form['name']['#title']->render(),
);
];
break;
case 'user_register_form':
$form['account']['name']['#title_display'] = 'invisible';
$form['account']['name']['#attributes'] = array(
$form['account']['name']['#attributes'] = [
'placeholder' => $form['account']['name']['#title']->render(),
);
];
$form['account']['mail']['#title_display'] = 'invisible';
$form['account']['mail']['#attributes'] = array(
$form['account']['mail']['#attributes'] = [
'placeholder' => $form['account']['mail']['#title']->render(),
);
];
break;
}
Loading