Update core 8.3.0

This commit is contained in:
Rob Davies 2017-04-13 15:53:35 +01:00
parent da7a7918f8
commit cd7a898e66
6144 changed files with 132297 additions and 87747 deletions

View file

@ -37,7 +37,7 @@ class PathItem extends FieldItemBase {
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition) {
return array();
return [];
}
/**
@ -62,7 +62,7 @@ class PathItem extends FieldItemBase {
else {
// Delete old alias if user erased it.
if ($this->pid && !$this->alias) {
\Drupal::service('path.alias_storage')->delete(array('pid' => $this->pid));
\Drupal::service('path.alias_storage')->delete(['pid' => $this->pid]);
}
// Only save a non-empty alias.
elseif ($this->alias) {

View file

@ -26,47 +26,47 @@ class PathWidget extends WidgetBase {
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$entity = $items->getEntity();
$path = array();
$path = [];
if (!$entity->isNew()) {
$conditions = array('source' => '/' . $entity->urlInfo()->getInternalPath());
$conditions = ['source' => '/' . $entity->urlInfo()->getInternalPath()];
if ($items->getLangcode() != LanguageInterface::LANGCODE_NOT_SPECIFIED) {
$conditions['langcode'] = $items->getLangcode();
}
$path = \Drupal::service('path.alias_storage')->load($conditions);
if ($path === FALSE) {
$path = array();
$path = [];
}
}
$path += array(
$path += [
'pid' => NULL,
'source' => !$entity->isNew() ? '/' . $entity->urlInfo()->getInternalPath() : NULL,
'alias' => '',
'langcode' => $items->getLangcode(),
);
];
$element += array(
'#element_validate' => array(array(get_class($this), 'validateFormElement')),
);
$element['alias'] = array(
$element += [
'#element_validate' => [[get_class($this), 'validateFormElement']],
];
$element['alias'] = [
'#type' => 'textfield',
'#title' => $element['#title'],
'#default_value' => $path['alias'],
'#required' => $element['#required'],
'#maxlength' => 255,
'#description' => $this->t('Specify an alternative path by which this data can be accessed. For example, type "/about" when writing an about page.'),
);
$element['pid'] = array(
];
$element['pid'] = [
'#type' => 'value',
'#value' => $path['pid'],
);
$element['source'] = array(
];
$element['source'] = [
'#type' => 'value',
'#value' => $path['source'],
);
$element['langcode'] = array(
];
$element['langcode'] = [
'#type' => 'value',
'#value' => $path['langcode'],
);
];
return $element;
}

View file

@ -58,7 +58,7 @@ class UrlAlias extends DestinationBase implements ContainerFactoryPluginInterfac
/**
* {@inheritdoc}
*/
public function import(Row $row, array $old_destination_id_values = array()) {
public function import(Row $row, array $old_destination_id_values = []) {
$source = $row->getDestinationProperty('source');
$alias = $row->getDestinationProperty('alias');
$langcode = $row->getDestinationProperty('langcode');
@ -75,7 +75,7 @@ class UrlAlias extends DestinationBase implements ContainerFactoryPluginInterfac
$path = $this->aliasStorage->save($source, $alias, $langcode, $pid);
return array($path['pid']);
return [$path['pid']];
}
/**

View file

@ -24,10 +24,10 @@ abstract class UrlAliasBase extends DrupalSqlBase {
* {@inheritdoc}
*/
public function fields() {
return array(
return [
'pid' => $this->t('The numeric identifier of the path alias.'),
'language' => $this->t('The language code of the URL alias.'),
);
];
}
/**