Commit 6098437e authored by alexpott's avatar alexpott

Issue #2572793 by attiks, andypost: Fix 'Drupal.WhiteSpace.OperatorSpacing' coding standard

parent 5c386edc
......@@ -623,7 +623,7 @@ function drupal_valid_test_ua($new_prefix = NULL) {
$user_agent = isset($_COOKIE['SIMPLETEST_USER_AGENT']) ? $_COOKIE['SIMPLETEST_USER_AGENT'] : $http_user_agent;
if (isset($user_agent) && preg_match("/^(simpletest\d+):(.+):(.+):(.+)$/", $user_agent, $matches)) {
list(, $prefix, $time, $salt, $hmac) = $matches;
$check_string = $prefix . ':' . $time . ':' . $salt;
$check_string = $prefix . ':' . $time . ':' . $salt;
// Read the hash salt prepared by drupal_generate_test_ua().
// This function is called before settings.php is read and Drupal's error
// handlers are set up. While Drupal's error handling may be properly
......
......@@ -1797,7 +1797,7 @@ function install_check_translations($langcode, $server_pattern) {
$writable = FALSE;
// @todo: Make this configurable.
$site_path = \Drupal::service('site.path');
$files_directory = $site_path . '/files';
$files_directory = $site_path . '/files';
$translations_directory = $site_path . '/files/translations';
$translations_directory_exists = FALSE;
$online = FALSE;
......
......@@ -515,7 +515,7 @@ function drupal_install_config_directories() {
// they can later be added to git. Since this directory is auto-created, we
// have to write out the README rather than just adding it to the drupal core
// repo.
$text = 'This directory contains configuration to be imported into your Drupal site. To make this configuration active, visit admin/config/development/configuration/sync.' .' For information about deploying configuration between servers, see https://www.drupal.org/documentation/administer/config';
$text = 'This directory contains configuration to be imported into your Drupal site. To make this configuration active, visit admin/config/development/configuration/sync.' .' For information about deploying configuration between servers, see https://www.drupal.org/documentation/administer/config';
file_put_contents(config_get_config_directory(CONFIG_SYNC_DIRECTORY) . '/README.txt', $text);
}
......
......@@ -1265,7 +1265,7 @@ function template_preprocess_html(&$variables) {
// Add a variable for the root path. This can be used to create a class and
// theme the page depending on the current path (e.g. node, admin, user) as
// well as more specific data like path-frontpage.
$is_front_page = \Drupal::service('path.matcher')->isFrontPage();
$is_front_page = \Drupal::service('path.matcher')->isFrontPage();
if ($is_front_page) {
$variables['root_path'] = FALSE;
......
......@@ -181,7 +181,7 @@ protected function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) {
}
}
$this->lcs = 0;
$this->seq[0]= $yoff - 1;
$this->seq[0] = $yoff - 1;
$this->in_seq = array();
$ymids[0] = array();
......@@ -190,11 +190,11 @@ protected function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) {
for ($chunk = 0; $chunk < $nchunks; $chunk++) {
if ($chunk > 0) {
for ($i = 0; $i <= $this->lcs; $i++) {
$ymids[$i][$chunk-1] = $this->seq[$i];
$ymids[$i][$chunk - 1] = $this->seq[$i];
}
}
$x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks);
$x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks);
for ( ; $x < $x1; $x++) {
$line = $flip ? $this->yv[$x] : $this->xv[$x];
if (empty($ymatches[$line])) {
......@@ -206,12 +206,12 @@ protected function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) {
if (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
$this::USE_ASSERTS && assert($k > 0);
$ymids[$k] = $ymids[$k-1];
$ymids[$k] = $ymids[$k - 1];
break;
}
}
while (list ($junk, $y) = each($matches)) {
if ($y > $this->seq[$k-1]) {
if ($y > $this->seq[$k - 1]) {
$this::USE_ASSERTS && assert($y < $this->seq[$k]);
// Optimization: this is a common case:
// next match is just replacing previous match.
......@@ -222,7 +222,7 @@ protected function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) {
elseif (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
$this::USE_ASSERTS && assert($k > 0);
$ymids[$k] = $ymids[$k-1];
$ymids[$k] = $ymids[$k - 1];
}
}
}
......
......@@ -50,7 +50,7 @@ public function save($name, $code) {
$path = $this->getFullPath($name);
$directory = dirname($path);
if ($this->ensureDirectory($directory)) {
$htaccess_path = $directory . '/.htaccess';
$htaccess_path = $directory . '/.htaccess';
if (!file_exists($htaccess_path) && file_put_contents($htaccess_path, static::htaccessLines())) {
@chmod($htaccess_path, 0444);
}
......@@ -126,7 +126,7 @@ public static function htaccessLines($private = TRUE) {
*/
protected function ensureDirectory($directory, $mode = 0777) {
if ($this->createDirectory($directory, $mode)) {
$htaccess_path = $directory . '/.htaccess';
$htaccess_path = $directory . '/.htaccess';
if (!file_exists($htaccess_path) && file_put_contents($htaccess_path, static::htaccessLines())) {
@chmod($htaccess_path, 0444);
}
......
......@@ -139,7 +139,7 @@ public function name($length = 8, $unique = FALSE) {
* @return string
*/
public function word($length) {
mt_srand((double) microtime()*1000000);
mt_srand((double) microtime() * 1000000);
$vowels = array("a", "e", "i", "o", "u");
$cons = array("b", "c", "d", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "u", "v", "w", "tr",
......
......@@ -83,7 +83,7 @@ public static function allowedIf($condition) {
* will be TRUE.
*/
public static function forbiddenIf($condition) {
return $condition ? static::forbidden(): static::neutral();
return $condition ? static::forbidden() : static::neutral();
}
/**
......
......@@ -70,7 +70,7 @@ public function extract($path, array $files = array()) {
*/
public function listContents() {
$files = array();
for ($i=0; $i < $this->zip->numFiles; $i++) {
for ($i = 0; $i < $this->zip->numFiles; $i++) {
$files[] = $this->zip->getNameIndex($i);
}
return $files;
......
......@@ -68,7 +68,7 @@ public function render(array $js_assets) {
'type' => 'application/json',
'data-drupal-selector' => 'drupal-settings-json',
);
$element['#value'] = Json::encode($js_asset['data']);
$element['#value'] = Json::encode($js_asset['data']);
break;
case 'file':
......
......@@ -272,7 +272,7 @@ public function getCacheKeys() {
// $this->configFactoryOverrides, add cache keys for each.
$keys[] = 'global_overrides';
foreach($this->configFactoryOverrides as $override) {
$keys[] = $override->getCacheSuffix();
$keys[] = $override->getCacheSuffix();
}
return $keys;
}
......
......@@ -165,7 +165,7 @@ public function getDependentEntities($type, $name) {
// If checking content, module, or theme dependencies, discover which
// entities are dependent on the entities that have a direct dependency.
foreach ($dependent_entities as $entity) {
$entities_to_check[] = $entity->getConfigDependencyName();
$entities_to_check[] = $entity->getConfigDependencyName();
}
}
$dependencies = array_merge($this->createGraphConfigEntityDependencies($entities_to_check), $dependent_entities);
......
......@@ -191,7 +191,7 @@ protected function castValue($key, $value) {
// we have to special case the meaning of an empty string for numeric
// types. In PHP this would be casted to a 0 but for the purposes of
// configuration we need to treat this as a NULL.
$empty_value = $value === '' && ($element instanceof IntegerInterface || $element instanceof FloatInterface);
$empty_value = $value === '' && ($element instanceof IntegerInterface || $element instanceof FloatInterface);
if ($value === NULL || $empty_value) {
$value = NULL;
......
......@@ -819,7 +819,7 @@ public function __toString() {
// Don't use the AS keyword for table aliases, as some
// databases don't support it (e.g., Oracle).
$query .= $table_string . ' ' . $this->connection->escapeTable($table['alias']);
$query .= $table_string . ' ' . $this->connection->escapeTable($table['alias']);
if (!empty($table['condition'])) {
$query .= ' ON ' . $table['condition'];
......
......@@ -234,12 +234,12 @@ public function formatDiff($from, $to, $options = array()) {
switch ($value) {
case 'y':
$interval_output = $this->formatPlural($interval->y, '1 year', '@count years', array(), array('langcode' => $options['langcode']));
$max_age = min($max_age, 365*86400);
$max_age = min($max_age, 365 * 86400);
break;
case 'm':
$interval_output = $this->formatPlural($interval->m, '1 month', '@count months', array(), array('langcode' => $options['langcode']));
$max_age = min($max_age, 30*86400);
$max_age = min($max_age, 30 * 86400);
break;
case 'd':
......@@ -252,7 +252,7 @@ public function formatDiff($from, $to, $options = array()) {
$interval_output .= $this->formatPlural($weeks, '1 week', '@count weeks', array(), array('langcode' => $options['langcode']));
$days -= $weeks * 7;
$granularity--;
$max_age = min($max_age, 7*86400);
$max_age = min($max_age, 7 * 86400);
}
if ((!$output || $weeks > 0) && $granularity > 0 && $days > 0) {
......
......@@ -88,7 +88,7 @@ public static function valueCallback(&$element, $input, FormStateInterface $form
break;
case 'hour':
$format = in_array('ampm', $element['#date_part_order']) ? 'g': 'G';
$format = in_array('ampm', $element['#date_part_order']) ? 'g' : 'G';
break;
case 'minute':
......@@ -218,7 +218,7 @@ public static function processDatelist(&$element, FormStateInterface $form_state
break;
case 'hour':
$format = in_array('ampm', $element['#date_part_order']) ? 'g': 'G';
$format = in_array('ampm', $element['#date_part_order']) ? 'g' : 'G';
$options = $date_helper->hours($format, $element['#required']);
$title = t('Hour');
break;
......
......@@ -50,7 +50,7 @@ public function process(ContainerBuilder $container) {
$root_namespace_dir = $namespaces[$root_namespace];
}
$message =<<<EOF
$message = <<<EOF
Missing proxy class '$proxy_class' for lazy service '$service_id'.
Use the following command to generate the proxy class:
......
......@@ -305,7 +305,7 @@ protected function initializePager() {
*/
public function tableSort(&$headers) {
// If 'field' is not initialized, the header columns aren't clickable.
foreach ($headers as $key =>$header) {
foreach ($headers as $key => $header) {
if (is_array($header) && isset($header['specifier'])) {
$headers[$key]['field'] = '';
}
......
......@@ -212,7 +212,7 @@ public function addField($field, $type, $langcode) {
$entity_type = $this->entityManager->getDefinition($entity_type_id);
$field_storage_definitions = $this->entityManager->getFieldStorageDefinitions($entity_type_id);
// Add the new entity base table using the table and sql column.
$join_condition= '%alias.' . $entity_type->getKey('id') . " = $table.$sql_column";
$join_condition = '%alias.' . $entity_type->getKey('id') . " = $table.$sql_column";
$base_table = $this->sqlQuery->leftJoin($entity_type->getBaseTable(), NULL, $join_condition);
$propertyDefinitions = array();
$key++;
......
......@@ -201,7 +201,7 @@ public function getFieldColumnName(FieldStorageDefinitionInterface $storage_defi
$field_name = $storage_definition->getName();
if ($this->allowsSharedTableStorage($storage_definition)) {
$column_name = count($storage_definition->getColumns()) == 1 ? $field_name : $field_name . '__' . $property_name;
$column_name = count($storage_definition->getColumns()) == 1 ? $field_name : $field_name . '__' . $property_name;
}
elseif ($this->requiresDedicatedTableStorage($storage_definition)) {
$column_name = !in_array($property_name, $this->getReservedColumns()) ? $field_name . '_' . $property_name : $property_name;
......
......@@ -1174,7 +1174,7 @@ protected function saveToDedicatedTables(ContentEntityInterface $entity, $update
$vid = $id;
}
$original = !empty($entity->original) ? $entity->original: NULL;
$original = !empty($entity->original) ? $entity->original : NULL;
// Determine which fields should be actually stored.
$definitions = $this->entityManager->getFieldDefinitions($entity_type, $bundle);
......
......@@ -1032,7 +1032,7 @@ public function doBuildForm($form_id, &$element, FormStateInterface &$form_state
// Assign a decimal placeholder weight to preserve original array order.
if (!isset($element[$key]['#weight'])) {
$element[$key]['#weight'] = $count/1000;
$element[$key]['#weight'] = $count / 1000;
}
else {
// If one of the child elements has a weight then we will need to sort
......
......@@ -78,7 +78,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $install_
),
);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => 'Save and continue',
'#button_type' => 'primary',
......
......@@ -72,7 +72,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $install_
$form['profile'][$profile_name]['#description'] = isset($profiles[$profile_name]['description']) ? $this->t($profiles[$profile_name]['description']) : '';
}
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Save and continue'),
'#button_type' => 'primary',
......
......@@ -131,7 +131,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
// distract from the message that the Drupal installation has completed
// successfully.)
$post_params = $this->getRequest()->request->all();
if (empty($post_params) && (!drupal_verify_install_file($this->root . '/' . $settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE) || !drupal_verify_install_file($this->root . '/' . $settings_dir, FILE_NOT_WRITABLE, 'dir'))) {
if (empty($post_params) && (!drupal_verify_install_file($this->root . '/' . $settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE) || !drupal_verify_install_file($this->root . '/' . $settings_dir, FILE_NOT_WRITABLE, 'dir'))) {
drupal_set_message(t('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the <a href=":handbook_url">online handbook</a>.', array('%dir' => $settings_dir, '%file' => $settings_file, ':handbook_url' => 'https://www.drupal.org/server-permissions')), 'warning');
}
......
......@@ -178,7 +178,7 @@ public function getTitle(LocalTaskInterface $local_task) {
* {@inheritdoc}
*/
public function getDefinitions() {
$definitions = parent::getDefinitions();
$definitions = parent::getDefinitions();
$count = 0;
foreach ($definitions as &$definition) {
......
......@@ -187,7 +187,7 @@ protected function crypt($algo, $password, $setting) {
} while (--$count);
$len = strlen($hash);
$output = $setting . $this->base64Encode($hash, $len);
$output = $setting . $this->base64Encode($hash, $len);
// $this->base64Encode() of a 16 byte MD5 will always be 22 characters.
// $this->base64Encode() of a 64 byte sha512 will always be 86 characters.
$expected = 12 + ceil((8 * $len) / 6);
......
......@@ -65,7 +65,7 @@ public static function valueCallback(&$element, $input, FormStateInterface $form
* Expand a password_confirm field into two text boxes.
*/
public static function processPasswordConfirm(&$element, FormStateInterface $form_state, &$complete_form) {
$element['pass1'] = array(
$element['pass1'] = array(
'#type' => 'password',
'#title' => t('Password'),
'#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'],
......@@ -73,7 +73,7 @@ public static function processPasswordConfirm(&$element, FormStateInterface $for
'#attributes' => array('class' => array('password-field', 'js-password-field')),
'#error_no_message' => TRUE,
);
$element['pass2'] = array(
$element['pass2'] = array(
'#type' => 'password',
'#title' => t('Confirm password'),
'#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'],
......
......@@ -96,7 +96,7 @@ public static function getFit($path) {
$fit = 0;
foreach ($parts as $k => $part) {
if (strpos($part, '{') === FALSE) {
$fit |= 1 << ($slashes - $k);
$fit |= 1 << ($slashes - $k);
}
}
......
......@@ -76,11 +76,11 @@ public function stream_open($uri, $mode, $options, &$opened_path) {
*/
public function stream_lock($operation) {
// Disallow exclusive lock or non-blocking lock requests
if (in_array($operation, array(LOCK_EX, LOCK_EX|LOCK_NB))) {
if (in_array($operation, array(LOCK_EX, LOCK_EX | LOCK_NB))) {
trigger_error('stream_lock() exclusive lock operations not supported for read-only stream wrappers', E_USER_WARNING);
return FALSE;
}
if (in_array($operation, array(LOCK_SH, LOCK_UN, LOCK_SH|LOCK_NB))) {
if (in_array($operation, array(LOCK_SH, LOCK_UN, LOCK_SH | LOCK_NB))) {
return flock($this->handle, $operation);
}
......
......@@ -111,11 +111,11 @@ public function stream_open($uri, $mode, $options, &$opened_path) {
* @see http://php.net/manual/streamwrapper.stream-lock.php
*/
public function stream_lock($operation) {
if (in_array($operation, array(LOCK_EX, LOCK_EX|LOCK_NB))) {
if (in_array($operation, array(LOCK_EX, LOCK_EX | LOCK_NB))) {
trigger_error('stream_lock() exclusive lock operations not supported for read-only stream wrappers', E_USER_WARNING);
return FALSE;
}
if (in_array($operation, array(LOCK_SH, LOCK_UN, LOCK_SH|LOCK_NB))) {
if (in_array($operation, array(LOCK_SH, LOCK_UN, LOCK_SH | LOCK_NB))) {
return flock($this->handle, $operation);
}
......
......@@ -50,7 +50,7 @@ function aggregator_help($route_name, RouteMatchInterface $route_match) {
case 'aggregator.admin_overview':
// Don't use placeholders for possibility to change URLs for translators.
$output = '<p>' . t('Many sites publish their headlines and posts in feeds, using a number of standardized XML-based formats. The aggregator supports <a href="http://en.wikipedia.org/wiki/Rss">RSS</a>, <a href="http://en.wikipedia.org/wiki/Resource_Description_Framework">RDF</a>, and <a href="http://en.wikipedia.org/wiki/Atom_%28standard%29">Atom</a>.') . '</p>';
$output .= '<p>' . t('Current feeds are listed below, and <a href=":addfeed">new feeds may be added</a>. For each feed, the <em>latest items</em> block may be enabled at the <a href=":block">blocks administration page</a>.', array(':addfeed' => \Drupal::url('aggregator.feed_add'), ':block' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '</p>';
$output .= '<p>' . t('Current feeds are listed below, and <a href=":addfeed">new feeds may be added</a>. For each feed, the <em>latest items</em> block may be enabled at the <a href=":block">blocks administration page</a>.', array(':addfeed' => \Drupal::url('aggregator.feed_add'), ':block' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '</p>';
return $output;
case 'aggregator.feed_add':
......
......@@ -75,7 +75,7 @@ public function testStringFormatter() {
$this->assertNotContains($aggregator_feed->getUrl(), $result);
// Verify aggregator item title with and without links.
$build = $aggregator_item->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' =>TRUE]]);
$build = $aggregator_item->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => TRUE]]);
$result = $this->render($build);
$this->assertContains('test title', $result);
......
......@@ -80,7 +80,7 @@ function block_content_add_body_field($block_type_id, $label = 'Body') {
$field = FieldConfig::loadByName('block_content', $block_type_id, 'body');
if (empty($field)) {
$field = FieldConfig::create([
'field_storage' => FieldStorageConfig::loadByName('block_content', 'body'),
'field_storage' => FieldStorageConfig::loadByName('block_content', 'body'),
'bundle' => $block_type_id,
'label' => $label,
'settings' => array('display_summary' => FALSE),
......
......@@ -195,7 +195,7 @@ public function getGroups() {
// Get the labels. This is not cacheable due to translation.
$group_labels = array();
foreach ($groups as $group) {
$group_labels[$group] = $this->getGroupLabel($group);
$group_labels[$group] = $this->getGroupLabel($group);
}
asort($group_labels);
return $group_labels;
......
......@@ -86,7 +86,7 @@ public function providerGetEnabledButtons() {
* @dataProvider providerGetEnabledButtons
*/
public function testGetEnabledButtons(array $toolbar_rows, array $expected_buttons) {
$editor= $this->prophesize(Editor::class);
$editor = $this->prophesize(Editor::class);
$editor->getSettings()
->willReturn(['toolbar' => ['rows' => $toolbar_rows]]);
......
......@@ -71,7 +71,7 @@ function color_form_system_theme_settings_alter(&$form, FormStateInterface $form
* Replaces style sheets declared in libraries with color-altered style sheets.
*/
function color_library_info_alter(&$libraries, $extension) {
$themes = array_keys(\Drupal::service('theme_handler')->listInfo());
$themes = array_keys(\Drupal::service('theme_handler')->listInfo());
if (in_array($extension, $themes)) {
$color_paths = \Drupal::config('color.theme.' . $extension)->get('stylesheets');
if (!empty($color_paths)) {
......@@ -780,7 +780,7 @@ function _color_hsl2rgb($hsl) {
$h = $hsl[0];
$s = $hsl[1];
$l = $hsl[2];
$m2 = ($l <= 0.5) ? $l * ($s + 1) : $l + $s - $l*$s;
$m2 = ($l <= 0.5) ? $l * ($s + 1) : $l + $s - $l * $s;
$m1 = $l * 2 - $m2;
return array(
......
......@@ -162,7 +162,7 @@ public function form(array $form, FormStateInterface $form_state) {
'#maxlength' => 60,
'#access' => $this->currentUser->isAnonymous() || $is_admin,
'#size' => 30,
'#attributes'=> [
'#attributes' => [
'data-drupal-default-value' => $config->get('anonymous'),
],
);
......
......@@ -66,7 +66,7 @@ public function __construct(Connection $database, AccountInterface $current_user
*/
public function read($entities, $entity_type, $accurate = TRUE) {
$options = $accurate ? array() : array('target' => 'replica');
$stats = $this->database->select('comment_entity_statistics', 'ces', $options)
$stats = $this->database->select('comment_entity_statistics', 'ces', $options)
->fields('ces')
->condition('ces.entity_id', array_keys($entities), 'IN')
->condition('ces.entity_type', $entity_type)
......
......@@ -164,7 +164,7 @@ public function save(array $form, FormStateInterface $form_state) {
else {
$this->commentManager->addBodyField($comment_type->id());
drupal_set_message(t('Comment type %label has been added.', array('%label' => $comment_type->label())));
$this->logger->notice('Comment type %label has been added.', array('%label' => $comment_type->label(), 'link' => $edit_link));
$this->logger->notice('Comment type %label has been added.', array('%label' => $comment_type->label(), 'link' => $edit_link));
}
$form_state->setRedirectUrl($comment_type->urlInfo('collection'));
......
......@@ -174,7 +174,7 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
// that page, we need to pass that subrequest route to our pager to
// keep the pager working.
$build['pager']['#route_name'] = $this->routeMatch->getRouteObject();
$build['pager']['#route_parameters'] = $this->routeMatch->getRawParameters()->all();
$build['pager']['#route_parameters'] = $this->routeMatch->getRawParameters()->all();
if ($this->getSetting('pager_id')) {
$build['pager']['#element'] = $this->getSetting('pager_id');
}
......
......@@ -23,7 +23,7 @@ public function getItems(ResultRow $values) {
foreach ($items as &$item) {
// Work out the depth of this comment.
$comment_thread = $item['rendered']['#markup'];
$item['rendered']['#markup'] = count(explode('.', $comment_thread)) - 1;
$item['rendered']['#markup'] = count(explode('.', $comment_thread)) - 1;
}
return $items;
}
......
......@@ -121,7 +121,7 @@ protected function doMenuListTest() {
$edit = array(
'id' => $menu_name,
'description' => '',
'label' => $label,
'label' => $label,
);
// Create the menu by posting the form.
$this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
......
......@@ -25,7 +25,7 @@
))
->values(array(
'category' => 'Upgrade test',
'recipients'=> 'test1@example.com,test2@example.com',
'recipients' => 'test1@example.com,test2@example.com',
'reply' => 'Test reply',
'weight' => 1,
'selected' => 1,
......
......@@ -364,7 +364,7 @@ protected function getAuthenticatedMockMessage($copy_sender = FALSE) {
$message->expects($this->once())
->method('copySender')
->willReturn($copy_sender);
$recipient =$this->getMock('\Drupal\user\UserInterface');
$recipient = $this->getMock('\Drupal\user\UserInterface');
$recipient->expects($this->once())
->method('getEmail')
->willReturn('user2@drupal.org');
......
......@@ -63,7 +63,7 @@ protected function alterRoutes(RouteCollection $collection) {
'entity_type_id' => $entity_type_id,
),
array(
'_entity_access' => $entity_type_id . '.view',
'_entity_access' => $entity_type_id . '.view',
'_access_content_translation_overview' => $entity_type_id,
),
array(
......@@ -89,7 +89,7 @@ protected function alterRoutes(RouteCollection $collection) {
),
array(
'_entity_access' => $entity_type_id . '.view',
'_entity_access' => $entity_type_id . '.view',
'_access_content_translation_manage' => 'create',
),
array(
......
......@@ -163,7 +163,7 @@ protected function doTestBasicTranslation() {
$language = ConfigurableLanguage::load($langcode);
$source_langcode = 'it';
$edit = array('source_langcode[source]' => $source_langcode);
$entity_type_id = $entity->getEntityTypeId();
$entity_type_id = $entity->getEntityTypeId();
$add_url = Url::fromRoute("entity.$entity_type_id.content_translation_add", [
$entity->getEntityTypeId() => $entity->id(),
'source' => $default_langcode,
......
......@@ -46,7 +46,7 @@ function _contextual_links_id_testcases() {
$tests[] = array(
'links' => array(
'foo' => array(
'route_parameters'=> array(
'route_parameters' => array(
'bar',
'key' => 'baz',
'qux',
......
......@@ -36,7 +36,7 @@ function datetime_help($route_name, RouteMatchInterface $route_match) {
$output .= '<dt>' . t('Managing and displaying date fields') . '</dt>';
$output .= '<dd>' . t('The <em>settings</em> and the <em>display</em> of the Date field can be configured separately. See the <a href=":field_ui">Field UI help</a> for more information on how to manage fields and their display.', array(':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#')) . '</dd>';
$output .= '<dt>' . t('Displaying dates') . '</dt>';
$output .= '<dd>' . t('Dates can be displayed using the <em>Plain</em> or the <em>Default</em> formatter. The <em>Plain</em> formatter displays the date in the <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> format. If you choose the <em>Default</em> formatter, you can choose a format from a predefined list that can be managed on the <a href=":date_format_list">Date and time formats</a> page.', array(':date_format_list'=> \Drupal::url('entity.date_format.collection'))) . '</dd>';
$output .= '<dd>' . t('Dates can be displayed using the <em>Plain</em> or the <em>Default</em> formatter. The <em>Plain</em> formatter displays the date in the <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> format. If you choose the <em>Default</em> formatter, you can choose a format from a predefined list that can be managed on the <a href=":date_format_list">Date and time formats</a> page.', array(':date_format_list' => \Drupal::url('entity.date_format.collection'))) . '</dd>';
$output .= '</dl>';
return $output;
}
......
......@@ -95,12 +95,12 @@ public static function processDefaultValue($default_value, FieldableEntityInterf
// A default value should be in the format and timezone used for date
// storage.
$date = new DrupalDateTime($default_value[0]['default_date'], DATETIME_STORAGE_TIMEZONE);
$storage_format = $definition->getSetting('datetime_type') == DateTimeItem::DATETIME_TYPE_DATE ? DATETIME_DATE_STORAGE_FORMAT: DATETIME_DATETIME_STORAGE_FORMAT;
$storage_format = $definition->getSetting('datetime_type') == DateTimeItem::DATETIME_TYPE_DATE ? DATETIME_DATE_STORAGE_FORMAT : DATETIME_DATETIME_STORAGE_FORMAT;
$value = $date->format($storage_format);
// We only provide a default value for the first item, as do all fields.
// Otherwise, there is no way to clear out unwanted values on multiple value
// fields.
$default_value = array(
$default_value = array(
array(
'value' => $value,
'date' => $date,
......