Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes

This commit is contained in:
Pantheon Automation 2016-04-20 09:56:34 -07:00 committed by Greg Anderson
parent b11a755ba8
commit c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Controller\PathController.
*/
namespace Drupal\path\Controller;
use Drupal\Component\Utility\Unicode;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Form\AddForm.
*/
namespace Drupal\path\Form;
use Drupal\Core\Language\LanguageInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Form\DeleteForm.
*/
namespace Drupal\path\Form;
use Drupal\Core\Form\ConfirmFormBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Form\EditForm.
*/
namespace Drupal\path\Form;
use Drupal\Core\Form\FormStateInterface;
@ -40,28 +35,25 @@ class EditForm extends PathFormBase {
'#type' => 'hidden',
'#value' => $this->path['pid'],
);
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => $this->t('Delete'),
'#submit' => array('::deleteSubmit'),
);
return $form;
}
/**
* Submits the delete form.
*/
public function deleteSubmit(array &$form, FormStateInterface $form_state) {
$url = new Url('path.delete', array(
'pid' => $form_state->getValue('pid'),
'pid' => $this->path['pid'],
));
if ($this->getRequest()->query->has('destination')) {
$url->setOption('query', $this->getDestinationArray());
$this->getRequest()->query->remove('destination');
}
$form_state->setRedirectUrl($url);
$form['actions']['delete'] = array(
'#type' => 'link',
'#title' => $this->t('Delete'),
'#url' => $url,
'#attributes' => array(
'class' => array('button', 'button--danger'),
),
);
return $form;
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Form\PathFilterForm.
*/
namespace Drupal\path\Form;
use Drupal\Core\Form\FormBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Form\PathFormBase.
*/
namespace Drupal\path\Form;
use Drupal\Core\Form\FormBase;
@ -116,7 +111,7 @@ abstract class PathFormBase extends FormBase {
'#default_value' => $this->path['alias'],
'#maxlength' => 255,
'#size' => 45,
'#description' => $this->t('Specify an alternative path by which this data can be accessed. For example, type "/about" when writing an about page. Use a relative path with a slash in front..'),
'#description' => $this->t('Specify an alternative path by which this data can be accessed. For example, type "/about" when writing an about page. Use a relative path with a slash in front.'),
'#field_prefix' => $this->requestContext->getCompleteBaseUrl(),
'#required' => TRUE,
);
@ -151,6 +146,7 @@ abstract class PathFormBase extends FormBase {
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Save'),
'#button_type' => 'primary',
);
return $form;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Plugin\Field\FieldType\PathFieldItemList.
*/
namespace Drupal\path\Plugin\Field\FieldType;
use Drupal\Core\Access\AccessResult;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Plugin\Field\FieldType\PathItem.
*/
namespace Drupal\path\Plugin\Field\FieldType;
use Drupal\Component\Utility\Random;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Plugin\Field\FieldWidget\PathWidget.
*/
namespace Drupal\path\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;

View file

@ -1,14 +1,9 @@
<?php
/**
* @file
* Contains \Drupal\path\Plugin\migrate\destination\UrlAlias.
*/
namespace Drupal\path\Plugin\migrate\destination;
use Drupal\Core\Path\AliasStorage;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Row;
use Drupal\migrate\Plugin\migrate\destination\DestinationBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -37,7 +32,7 @@ class UrlAlias extends DestinationBase implements ContainerFactoryPluginInterfac
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param MigrationInterface $migration
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The migration.
* @param \Drupal\Core\Path\AliasStorage $alias_storage
* The alias storage service.
@ -90,8 +85,8 @@ class UrlAlias extends DestinationBase implements ContainerFactoryPluginInterfac
return [
'pid' => 'The path id',
'source' => 'The source path.',
'alias' => 'The url alias.',
'langcode' => 'The language code for the url.',
'alias' => 'The URL alias.',
'langcode' => 'The language code for the URL.',
];
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Plugin\migrate\process\d6\UrlAliasLanguage.
*/
namespace Drupal\path\Plugin\migrate\process\d6;
use Drupal\migrate\MigrateExecutableInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Plugin\migrate\source\UrlAliasBase.
*/
namespace Drupal\path\Plugin\migrate\source;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
@ -27,7 +22,7 @@ abstract class UrlAliasBase extends DrupalSqlBase {
public function fields() {
return array(
'pid' => $this->t('The numeric identifier of the path alias.'),
'language' => $this->t('The language code of the url alias.'),
'language' => $this->t('The language code of the URL alias.'),
);
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Plugin\migrate\source\d6\UrlAlias.
*/
namespace Drupal\path\Plugin\migrate\source\d6;
use Drupal\path\Plugin\migrate\source\UrlAliasBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Plugin\migrate\source\d7\UrlAlias.
*/
namespace Drupal\path\Plugin\migrate\source\d7;
use Drupal\path\Plugin\migrate\source\UrlAliasBase;

View file

@ -1,104 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\path\Tests\Migrate\d6\MigrateUrlAliasTest.
*/
namespace Drupal\path\Tests\Migrate\d6;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate\Plugin\MigrateIdMapInterface;
use Drupal\Core\Database\Database;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* URL alias migration.
*
* @group migrate_drupal_6
*/
class MigrateUrlAliasTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = array('path');
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installSchema('system', ['url_alias']);
$this->executeMigration('d6_url_alias');
}
/**
* Assert a path.
*
* @param string pid
* The path id.
* @param array $conditions
* The path conditions.
* @param array $path
* The path.
*/
private function assertPath($pid, $conditions, $path) {
$this->assertTrue($path, "Path alias for " . $conditions['source'] . " successfully loaded.");
$this->assertIdentical($conditions['alias'], $path['alias']);
$this->assertIdentical($conditions['langcode'], $path['langcode']);
$this->assertIdentical($conditions['source'], $path['source']);
}
/**
* Test the url alias migration.
*/
public function testUrlAlias() {
$id_map = Migration::load('d6_url_alias')->getIdMap();
$conditions = array(
'source' => '/node/1',
'alias' => '/alias-one',
'langcode' => 'af',
);
$path = \Drupal::service('path.alias_storage')->load($conditions);
$this->assertPath('1', $conditions, $path);
$this->assertIdentical($id_map->lookupDestinationID(array($path['pid'])), array('1'), "Test IdMap");
$conditions = array(
'source' => '/node/2',
'alias' => '/alias-two',
'langcode' => 'en',
);
$path = \Drupal::service('path.alias_storage')->load($conditions);
$this->assertPath('2', $conditions, $path);
// Test that we can re-import using the UrlAlias destination.
Database::getConnection('default', 'migrate')
->update('url_alias')
->fields(array('dst' => 'new-url-alias'))
->condition('src', 'node/2')
->execute();
\Drupal::database()
->update($id_map->mapTableName())
->fields(array('source_row_status' => MigrateIdMapInterface::STATUS_NEEDS_UPDATE))
->execute();
$migration = \Drupal::entityManager()
->getStorage('migration')
->loadUnchanged('d6_url_alias');
$this->executeMigration($migration);
$path = \Drupal::service('path.alias_storage')->load(array('pid' => $path['pid']));
$conditions['alias'] = '/new-url-alias';
$this->assertPath('2', $conditions, $path);
$conditions = array(
'source' => '/node/3',
'alias' => '/alias-three',
'langcode' => 'und',
);
$path = \Drupal::service('path.alias_storage')->load($conditions);
$this->assertPath('3', $conditions, $path);
}
}

View file

@ -1,47 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\path\Tests\Migrate\d7\MigrateUrlAliasTest.
*/
namespace Drupal\path\Tests\Migrate\d7;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
/**
* Tests URL alias migration.
*
* @group path
*/
class MigrateUrlAliasTest extends MigrateDrupal7TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['path'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installSchema('system', ['url_alias']);
$this->executeMigration('d7_url_alias');
}
/**
* Test the URL alias migration.
*/
public function testUrlAlias() {
$path = \Drupal::service('path.alias_storage')->load([
'source' => '/taxonomy/term/4',
'alias' => '/term33',
'langcode' => 'und',
]);
$this->assertIdentical('/taxonomy/term/4', $path['source']);
$this->assertIdentical('/term33', $path['alias']);
$this->assertIdentical('und', $path['langcode']);
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Tests\PathAdminTest.
*/
namespace Drupal\path\Tests;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Tests\PathAliasTest.
*/
namespace Drupal\path\Tests;
use Drupal\Component\Utility\Unicode;
@ -145,7 +140,9 @@ class PathAliasTest extends PathTestBase {
]), 'Attempt to move upper-case alias was rejected.');
// Delete alias.
$this->drupalPostForm('admin/config/search/path/edit/' . $pid, array(), t('Delete'));
$this->drupalGet('admin/config/search/path/edit/' . $pid);
$this->clickLink(t('Delete'));
$this->assertRaw(t('Are you sure you want to delete path alias %name?', array('%name' => $edit['alias'])));
$this->drupalPostForm(NULL, array(), t('Confirm'));
// Confirm that the alias no longer works.

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Tests\PathLanguageTest.
*/
namespace Drupal\path\Tests;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Tests\PathLanguageUiTest.
*/
namespace Drupal\path\Tests;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Tests\PathNodeFormTest.
*/
namespace Drupal\path\Tests;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Tests\PathTaxonomyTermTest.
*/
namespace Drupal\path\Tests;
use Drupal\taxonomy\Entity\Vocabulary;
@ -27,10 +22,10 @@ class PathTaxonomyTermTest extends PathTestBase {
parent::setUp();
// Create a Tags vocabulary for the Article node type.
$vocabulary = entity_create('taxonomy_vocabulary', array(
$vocabulary = Vocabulary::create([
'name' => t('Tags'),
'vid' => 'tags',
));
]);
$vocabulary->save();
// Create and login user.

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\path\Tests\PathTestBase.
*/
namespace Drupal\path\Tests;
use Drupal\simpletest\WebTestBase;