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

@ -209,7 +209,7 @@ function hook_block_access(\Drupal\block\Entity\Block $block, $operation, \Drupa
// Example code that would prevent displaying the 'Powered by Drupal' block in
// a region different than the footer.
if ($operation == 'view' && $block->getPluginId() == 'system_powered_by_block') {
return AccessResult::forbiddenIf($block->getRegion() != 'footer')->cacheUntilEntityChanges($block);
return AccessResult::forbiddenIf($block->getRegion() != 'footer')->addCacheableDependency($block);
}
// No opinion.

View file

@ -16,4 +16,4 @@ drupal.block.admin:
dependencies:
- core/jquery
- core/drupal
- core/drupal.ajax
- core/drupal.dialog.ajax

View file

@ -3,7 +3,7 @@
* Block behaviors.
*/
(function ($, window) {
(function ($, window, Drupal) {
'use strict';
@ -20,7 +20,7 @@
// The drupalSetSummary method required for this behavior is not available
// on the Blocks administration page, so we need to make sure this
// behavior is processed only if drupalSetSummary is defined.
if (typeof jQuery.fn.drupalSetSummary === 'undefined') {
if (typeof $.fn.drupalSetSummary === 'undefined') {
return;
}
@ -78,6 +78,78 @@
return;
}
/**
* Function to check empty regions and toggle classes based on this.
*
* @param {jQuery} table
* The jQuery object representing the table to inspect.
* @param {jQuery} rowObject
* The jQuery object representing the table row.
*/
function checkEmptyRegions(table, rowObject) {
table.find('tr.region-message').each(function () {
var $this = $(this);
// If the dragged row is in this region, but above the message row,
// swap it down one space.
if ($this.prev('tr').get(0) === rowObject.element) {
// Prevent a recursion problem when using the keyboard to move rows
// up.
if ((rowObject.method !== 'keyboard' || rowObject.direction === 'down')) {
rowObject.swap('after', this);
}
}
// This region has become empty.
if ($this.next('tr').is(':not(.draggable)') || $this.next('tr').length === 0) {
$this.removeClass('region-populated').addClass('region-empty');
}
// This region has become populated.
else if ($this.is('.region-empty')) {
$this.removeClass('region-empty').addClass('region-populated');
}
});
}
/**
* Function to update the last placed row with the correct classes.
*
* @param {jQuery} table
* The jQuery object representing the table to inspect.
* @param {jQuery} rowObject
* The jQuery object representing the table row.
*/
function updateLastPlaced(table, rowObject) {
// Remove the color-success class from new block if applicable.
table.find('.color-success').removeClass('color-success');
var $rowObject = $(rowObject);
if (!$rowObject.is('.drag-previous')) {
table.find('.drag-previous').removeClass('drag-previous');
$rowObject.addClass('drag-previous');
}
}
/**
* Update block weights in the given region.
*
* @param {jQuery} table
* Table with draggable items.
* @param {string} region
* Machine name of region containing blocks to update.
*/
function updateBlockWeights(table, region) {
// Calculate minimum weight.
var weight = -Math.round(table.find('.draggable').length / 2);
// Update the block weights.
table.find('.region-' + region + '-message').nextUntil('.region-title')
.find('select.block-weight').val(function () {
// Increment the weight before assigning it to prevent using the
// absolute minimum available weight. This way we always have an
// unused upper and lower bound, which makes manually setting the
// weights easier for users who prefer to do it that way.
return ++weight;
});
}
var table = $('#blocks');
// Get the blocks tableDrag object.
var tableDrag = Drupal.tableDrag.blocks;
@ -150,71 +222,7 @@
// Remove focus from selectbox.
select.trigger('blur');
});
var updateLastPlaced = function ($table, rowObject) {
// Remove the color-success class from new block if applicable.
$table.find('.color-success').removeClass('color-success');
var $rowObject = $(rowObject);
if (!$rowObject.is('.drag-previous')) {
$table.find('.drag-previous').removeClass('drag-previous');
$rowObject.addClass('drag-previous');
}
};
/**
* Update block weights in the given region.
*
* @param {jQuery} $table
* Table with draggable items.
* @param {string} region
* Machine name of region containing blocks to update.
*/
var updateBlockWeights = function ($table, region) {
// Calculate minimum weight.
var weight = -Math.round($table.find('.draggable').length / 2);
// Update the block weights.
$table.find('.region-' + region + '-message').nextUntil('.region-title')
.find('select.block-weight').val(function () {
// Increment the weight before assigning it to prevent using the
// absolute minimum available weight. This way we always have an
// unused upper and lower bound, which makes manually setting the
// weights easier for users who prefer to do it that way.
return ++weight;
});
};
/**
* Checks empty regions and toggles classes based on this.
*
* @param {jQuery} table
* The jQuery object representing the table to inspect.
* @param {jQuery} rowObject
* The jQuery object representing the table row.
*/
var checkEmptyRegions = function (table, rowObject) {
table.find('tr.region-message').each(function () {
var $this = $(this);
// If the dragged row is in this region, but above the message row,
// swap it down one space.
if ($this.prev('tr').get(0) === rowObject.element) {
// Prevent a recursion problem when using the keyboard to move rows
// up.
if ((rowObject.method !== 'keyboard' || rowObject.direction === 'down')) {
rowObject.swap('after', this);
}
}
// This region has become empty.
if ($this.next('tr').is(':not(.draggable)') || $this.next('tr').length === 0) {
$this.removeClass('region-populated').addClass('region-empty');
}
// This region has become populated.
else if ($this.is('.region-empty')) {
$this.removeClass('region-empty').addClass('region-populated');
}
});
};
}
};
})(jQuery, window);
})(jQuery, window, Drupal);

0
core/modules/block/migration_templates/d7_block.yml Executable file → Normal file
View file

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\BlockAccessControlHandler.
*/
namespace Drupal\block;
use Drupal\Component\Plugin\Exception\ContextException;
@ -96,7 +91,7 @@ class BlockAccessControlHandler extends EntityAccessControlHandler implements En
// Don't grant access to disabled blocks.
if (!$entity->status()) {
return AccessResult::forbidden()->cacheUntilEntityChanges($entity);
return AccessResult::forbidden()->addCacheableDependency($entity);
}
else {
$conditions = [];
@ -151,7 +146,7 @@ class BlockAccessControlHandler extends EntityAccessControlHandler implements En
$this->mergeCacheabilityFromConditions($access, $conditions);
// Ensure that access is evaluated again when the block changes.
return $access->cacheUntilEntityChanges($entity);
return $access->addCacheableDependency($entity);
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\BlockForm.
*/
namespace Drupal\block;
use Drupal\Component\Utility\Html;
@ -85,7 +80,7 @@ class BlockForm extends EntityForm {
* @param \Drupal\Core\Language\LanguageManagerInterface $language
* The language manager.
* @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
* The theme handler.
* The theme handler.
*/
public function __construct(EntityManagerInterface $entity_manager, ExecutableManagerInterface $manager, ContextRepositoryInterface $context_repository, LanguageManagerInterface $language, ThemeHandlerInterface $theme_handler) {
$this->storage = $entity_manager->getStorage('block');

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\BlockInterface.
*/
namespace Drupal\block;
use Drupal\Core\Config\Entity\ConfigEntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\BlockListBuilder.
*/
namespace Drupal\block;
use Drupal\Component\Utility\Html;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\BlockPluginCollection.
*/
namespace Drupal\block;
use Drupal\Component\Plugin\Exception\PluginException;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\BlockRepository.
*/
namespace Drupal\block;
use Drupal\Core\Cache\CacheableMetadata;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\BlockRepositoryInterface.
*/
namespace Drupal\block;
interface BlockRepositoryInterface {

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\BlockViewBuilder.
*/
namespace Drupal\block;
use Drupal\Core\Block\MainContentBlockPluginInterface;
@ -250,6 +245,6 @@ class BlockViewBuilder extends EntityViewBuilder {
}
}
return $build;
}
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Controller\BlockAddController.
*/
namespace Drupal\block\Controller;
use Drupal\Core\Controller\ControllerBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Controller\BlockController.
*/
namespace Drupal\block\Controller;
use Drupal\Component\Utility\Html;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Controller\BlockLibraryController.
*/
namespace Drupal\block\Controller;
use Drupal\Component\Serialization\Json;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Controller\BlockListController.
*/
namespace Drupal\block\Controller;
use Drupal\Core\Entity\Controller\EntityListController;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Controller\CategoryAutocompleteController.
*/
namespace Drupal\block\Controller;
use Drupal\Component\Utility\Html;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Entity\Block.
*/
namespace Drupal\block\Entity;
use Drupal\Core\Cache\Cache;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\EventSubscriber\BlockPageDisplayVariantSubscriber.
*/
namespace Drupal\block\EventSubscriber;
use Drupal\Core\Render\PageDisplayVariantSelectionEvent;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Form\BlockDeleteForm.
*/
namespace Drupal\block\Form;
use Drupal\Core\Entity\EntityDeleteForm;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Plugin\Derivative\ThemeLocalTask.
*/
namespace Drupal\block\Plugin\Derivative;
use Drupal\Component\Plugin\Derivative\DeriverBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Plugin\DisplayVariant\BlockPageVariant.
*/
namespace Drupal\block\Plugin\DisplayVariant;
use Drupal\block\BlockRepositoryInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Plugin\migrate\destination\EntityBlock.
*/
namespace Drupal\block\Plugin\migrate\destination;
use Drupal\migrate\Plugin\migrate\destination\EntityConfigBase;

View file

@ -1,15 +1,10 @@
<?php
/**
* @file
* Contains \Drupal\block\Plugin\migrate\process\BlockPluginId.
*/
namespace Drupal\block\Plugin\migrate\process;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Plugin\MigrateProcessInterface;
use Drupal\migrate\ProcessPluginBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Plugin\migrate\process\BlockRegion.
*/
namespace Drupal\block\Plugin\migrate\process;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Plugin\migrate\process\BlockSettings.
*/
namespace Drupal\block\Plugin\migrate\process;
use Drupal\block\BlockInterface;

View file

@ -1,13 +1,8 @@
<?php
/**
* @file
* Contains \Drupal\block\Plugin\migrate\process\BlockTheme.
*/
namespace Drupal\block\Plugin\migrate\process;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
@ -45,7 +40,7 @@ class BlockTheme extends ProcessPluginBase implements ContainerFactoryPluginInte
* The plugin ID for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\migrate\Entity\MigrationInterface $migration
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The migration entity.
* @param \Drupal\Core\Config\Config $theme_config
* The system.theme configuration factory object.

View file

@ -1,15 +1,10 @@
<?php
/**
* @file
* Contains \Drupal\block\Plugin\migrate\process\BlockVisibility.
*/
namespace Drupal\block\Plugin\migrate\process;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\MigrateProcessInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Plugin\migrate\source\Block.
*/
namespace Drupal\block\Plugin\migrate\source;
use Drupal\migrate\Row;

View file

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

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockCacheTest.
*/
namespace Drupal\block\Tests;
use Drupal\Core\Cache\Cache;

View file

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

View file

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

View file

@ -1,19 +1,12 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockHookOperationTest.
*
* Tests for Block module regarding hook_entity_operations_alter().
*/
namespace Drupal\block\Tests;
use Drupal\Component\Utility\Unicode;
use Drupal\simpletest\WebTestBase;
/**
* Implement hook entity operations alter.
* Tests for Block module regarding hook_entity_operations_alter().
*
* @group block
*/

View file

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

View file

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

View file

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

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockLanguageCacheTest.
*/
namespace Drupal\block\Tests;
use Drupal\Component\Utility\Unicode;

View file

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

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockRenderOrderTest.
*/
namespace Drupal\block\Tests;
use Drupal\Component\Utility\Html;
@ -70,7 +65,7 @@ class BlockRenderOrderTest extends WebTestBase {
$this->drupalGet('');
$test_content = $this->getRawContent('');
$controller = $this->container->get('entity.manager')->getStorage('block');
$controller = $this->container->get('entity_type.manager')->getStorage('block');
foreach ($controller->loadMultiple() as $return_block) {
$id = $return_block->id();
if ($return_block_weight = $return_block->getWeight()) {

View file

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

View file

@ -1,12 +1,8 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockTemplateSuggestionsTest.
*/
namespace Drupal\block\Tests;
use Drupal\block\Entity\Block;
use Drupal\simpletest\WebTestBase;
/**
@ -31,8 +27,7 @@ class BlockTemplateSuggestionsTest extends WebTestBase {
// an underscore (not transformed) and a hyphen (transformed to underscore),
// and generates possibilities for each level of derivative.
// @todo Clarify this comment.
/** @var \Drupal\block\BlockInterface $block */
$block = entity_create('block', array(
$block = Block::create(array(
'plugin' => 'system_menu_block:admin',
'region' => 'footer',
'id' => 'machinename',

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockTest.
*/
namespace Drupal\block\Tests;
use Drupal\Component\Utility\Html;
@ -32,6 +27,7 @@ class BlockTest extends BlockTestBase {
'id' => strtolower($this->randomMachineName(8)),
'region' => 'sidebar_first',
'settings[label]' => $title,
'settings[label_display]' => TRUE,
);
// Set the block to be hidden on any user path, and to be shown only to
// authenticated users.
@ -142,11 +138,12 @@ class BlockTest extends BlockTestBase {
$block = array();
$block['id'] = 'system_powered_by_block';
$block['settings[label]'] = $this->randomMachineName(8);
$block['settings[label_display]'] = TRUE;
$block['theme'] = $this->config('system.theme')->get('default');
$block['region'] = 'header';
// Set block title to confirm that interface works and override any custom titles.
$this->drupalPostForm('admin/structure/block/add/' . $block['id'] . '/' . $block['theme'], array('settings[label]' => $block['settings[label]'], 'id' => $block['id'], 'region' => $block['region']), t('Save block'));
$this->drupalPostForm('admin/structure/block/add/' . $block['id'] . '/' . $block['theme'], array('settings[label]' => $block['settings[label]'], 'settings[label_display]' => $block['settings[label_display]'], 'id' => $block['id'], 'region' => $block['region']), t('Save block'));
$this->assertText(t('The block configuration has been saved.'), 'Block title set.');
// Check to see if the block was created by checking its configuration.
$instance = Block::load($block['id']);
@ -255,19 +252,19 @@ class BlockTest extends BlockTestBase {
$this->assertText('The block configuration has been saved.', 'Block was saved');
$this->drupalGet('user');
$this->assertText($title, 'Block title was displayed by default.');
$this->assertNoText($title, 'Block title was not displayed by default.');
$edit = array(
'settings[label_display]' => FALSE,
'settings[label_display]' => TRUE,
);
$this->drupalPostForm('admin/structure/block/manage/' . $id, $edit, t('Save block'));
$this->assertText('The block configuration has been saved.', 'Block was saved');
$this->drupalGet('admin/structure/block/manage/' . $id);
$this->assertNoFieldChecked('edit-settings-label-display', 'The display_block option has the correct default value on the configuration form.');
$this->assertFieldChecked('edit-settings-label-display', 'The display_block option has the correct default value on the configuration form.');
$this->drupalGet('user');
$this->assertNoText($title, 'Block title was not displayed when hidden.');
$this->assertText($title, 'Block title was displayed when enabled.');
}
/**

View file

@ -1,13 +1,9 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockTestBase.
*/
namespace Drupal\block\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\filter\Entity\FilterFormat;
/**
* Provides setup and helper methods for block module tests.
@ -42,7 +38,7 @@ abstract class BlockTestBase extends WebTestBase {
$this->config('system.site')->set('page.front', '/test-page')->save();
// Create Full HTML text format.
$full_html_format = entity_create('filter_format', array(
$full_html_format = FilterFormat::create(array(
'format' => 'full_html',
'name' => 'Full HTML',
));
@ -65,7 +61,7 @@ abstract class BlockTestBase extends WebTestBase {
'sidebar_second',
'footer',
);
$block_storage = $this->container->get('entity.manager')->getStorage('block');
$block_storage = $this->container->get('entity_type.manager')->getStorage('block');
$blocks = $block_storage->loadByProperties(array('theme' => $this->config('system.theme')->get('default')));
foreach ($blocks as $block) {
$block->delete();

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockUiTest.
*/
namespace Drupal\block\Tests;
use Drupal\Component\Utility\Html;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockXssTest.
*/
namespace Drupal\block\Tests;
use Drupal\block_content\Entity\BlockContent;

View file

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

View file

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

View file

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

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\Update\BlockContextMappingUpdateTest.
*/
namespace Drupal\block\Tests\Update;
use Drupal\block\Entity\Block;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\Views\DisplayBlockTest.
*/
namespace Drupal\block\Tests\Views;
use Drupal\Component\Serialization\Json;
@ -145,7 +140,7 @@ class DisplayBlockTest extends ViewTestBase {
$this->assertBlockAppears($block_3);
$this->assertBlockAppears($block_4);
$block_storage = $this->container->get('entity.manager')->getStorage('block');
$block_storage = $this->container->get('entity_type.manager')->getStorage('block');
// Remove the block display, so both block entities from the first view
// should both disappear.
@ -192,7 +187,7 @@ class DisplayBlockTest extends ViewTestBase {
$this->assertNoFieldById('edit-machine-name', 'views_block__test_view_block_1', 'The machine name is hidden on the views block form.');
// Save the block.
$this->drupalPostForm(NULL, array(), t('Save block'));
$storage = $this->container->get('entity.manager')->getStorage('block');
$storage = $this->container->get('entity_type.manager')->getStorage('block');
$block = $storage->load('views_block__test_view_block_block_1');
// This will only return a result if our new block has been created with the
// expected machine name.

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block\Theme\AdminDemoNegotiator.
*/
namespace Drupal\block\Theme;
use Drupal\Core\Routing\RouteMatchInterface;

View file

@ -1,23 +0,0 @@
{#
/**
* @file
* Two column template for the block add/edit form.
*
* This template will be used when a block edit form specifies 'block_edit_form'
* as its #theme callback. Otherwise, by default, block add/edit forms will be
* themed by form.html.twig.
*
* Available variables:
* - form: The block add/edit form.
*
* @ingroup themeable
*/
#}
<div class="layout-block-list clearfix">
<div class="layout-region block-list-primary">
{{ form|without('place_blocks') }}
</div>
<div class="layout-region block-list-secondary">
{{ form.place_blocks }}
</div>
</div>

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block_test\ContextProvider\MultipleStaticContext.
*/
namespace Drupal\block_test\ContextProvider;
use Drupal\Core\Cache\CacheableMetadata;

View file

@ -1,8 +1,4 @@
<?php
/**
* @file
* Contains \Drupal\block_test\Controller\TestMultipleFormController.
*/
namespace Drupal\block_test\Controller;

View file

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

View file

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

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block_test\Plugin\Block\TestAccessBlock.
*/
namespace Drupal\block_test\Plugin\Block;
use Drupal\Core\Access\AccessResult;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block_test\Plugin\Block\TestBlockInstantiation.
*/
namespace Drupal\block_test\Plugin\Block;
use Drupal\Core\Access\AccessResult;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block_test\Plugin\Block\TestCacheBlock.
*/
namespace Drupal\block_test\Plugin\Block;
use Drupal\Core\Block\BlockBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block_test\Plugin\Block\TestContextAwareBlock.
*/
namespace Drupal\block_test\Plugin\Block;
use Drupal\Core\Block\BlockBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block_test\Plugin\Block\TestContextAwareUnsatisfiedBlock.
*/
namespace Drupal\block_test\Plugin\Block;
use Drupal\Core\Block\BlockBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block_test\Plugin\Block\TestFormBlock.
*/
namespace Drupal\block_test\Plugin\Block;
use Drupal\Core\Block\BlockBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block_test\Plugin\Block\TestHtmlBlock.
*/
namespace Drupal\block_test\Plugin\Block;
use Drupal\Core\Block\BlockBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block_test\Plugin\Block\TestXSSTitleBlock.
*/
namespace Drupal\block_test\Plugin\Block;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\block_test\Plugin\Condition\BaloneySpam.
*/
namespace Drupal\block_test\Plugin\Condition;
use Drupal\Core\Condition\ConditionPluginBase;

View file

@ -1,15 +1,10 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockConfigSchemaTest.
*/
namespace Drupal\block\Tests;
namespace Drupal\Tests\block\Kernel;
use Drupal\block\Entity\Block;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the block config schema.

View file

@ -1,15 +1,10 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockInterfaceTest.
*/
namespace Drupal\block\Tests;
namespace Drupal\Tests\block\Kernel;
use Drupal\Core\Form\FormState;
use Drupal\simpletest\KernelTestBase;
use Drupal\block\BlockInterface;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests that the block plugin can work properly without a supporting entity.
@ -17,6 +12,7 @@ use Drupal\block\BlockInterface;
* @group block
*/
class BlockInterfaceTest extends KernelTestBase {
public static $modules = array('system', 'block', 'block_test', 'user');
/**

View file

@ -1,14 +1,9 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockStorageUnitTest.
*/
namespace Drupal\block\Tests;
namespace Drupal\Tests\block\Kernel;
use Drupal\Core\Config\Entity\ConfigEntityStorage;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\block_test\Plugin\Block\TestHtmlBlock;
use Drupal\Component\Plugin\Exception\PluginException;
use Drupal\block\Entity\Block;
@ -26,7 +21,7 @@ class BlockStorageUnitTest extends KernelTestBase {
*
* @var array
*/
public static $modules = array('block', 'block_test');
public static $modules = array('block', 'block_test', 'system');
/**
* The block storage.
@ -38,7 +33,7 @@ class BlockStorageUnitTest extends KernelTestBase {
protected function setUp() {
parent::setUp();
$this->controller = $this->container->get('entity.manager')->getStorage('block');
$this->controller = $this->container->get('entity_type.manager')->getStorage('block');
}
/**

View file

@ -1,16 +1,11 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\BlockViewBuilderTest.
*/
namespace Drupal\block\Tests;
namespace Drupal\Tests\block\Kernel;
use Drupal\Component\Utility\Html;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\LanguageInterface;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\block\Entity\Block;
/**
@ -55,7 +50,7 @@ class BlockViewBuilderTest extends KernelTestBase {
parent::setUp();
$this->controller = $this->container
->get('entity.manager')
->get('entity_type.manager')
->getStorage('block');
\Drupal::state()->set('block_test.content', 'Llamas &gt; unicorns!');
@ -327,7 +322,7 @@ class BlockViewBuilderTest extends KernelTestBase {
* The render array.
*/
protected function getBlockRenderArray() {
return $this->container->get('entity.manager')->getViewBuilder('block')->view($this->block, 'block');
return $this->container->get('entity_type.manager')->getViewBuilder('block')->view($this->block, 'block');
}
}

View file

@ -1,14 +1,9 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\Migrate\d6\MigrateBlockTest.
*/
namespace Drupal\block\Tests\Migrate\d6;
namespace Drupal\Tests\block\Kernel\Migrate\d6;
use Drupal\block\Entity\Block;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Tests migration of blocks to configuration entities.

View file

@ -1,15 +1,10 @@
<?php
/**
* @file
* Contains \Drupal\block\Tests\Migrate\d7\MigrateBlockTest.
*/
namespace Drupal\block\Tests\Migrate\d7;
namespace Drupal\Tests\block\Kernel\Migrate\d7;
use Drupal\block\Entity\Block;
use Drupal\block_content\Entity\BlockContent;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
/**
* Tests migration of blocks to configuration entities.
@ -81,7 +76,6 @@ class MigrateBlockTest extends MigrateDrupal7TestBase {
* The block label.
* @param string $label_display
* The block label display setting.
*/
public function assertEntity($id, $plugin_id, array $roles, $pages, $region, $theme, $weight, $label, $label_display) {
$block = Block::load($id);

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\block\Unit\BlockConfigEntityUnitTest.
*/
namespace Drupal\Tests\block\Unit;
use Drupal\Core\DependencyInjection\ContainerBuilder;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\block\Unit\BlockFormTest.
*/
namespace Drupal\Tests\block\Unit;
use Drupal\block\BlockForm;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\block\Unit\CategoryAutocompleteTest.
*/
namespace Drupal\Tests\block\Unit;
use Drupal\Component\Utility\Html;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\block\Unit\Menu\BlockLocalTasksTest.
*/
namespace Drupal\Tests\block\Unit\Menu;
use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\block\Unit\Plugin\DisplayVariant\BlockPageVariantTest.
*/
namespace Drupal\Tests\block\Unit\Plugin\DisplayVariant;
use Drupal\Core\Cache\CacheableMetadata;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\block\Unit\Plugin\migrate\process\BlockRegionTest.
*/
namespace Drupal\Tests\block\Unit\Plugin\migrate\process;
use Drupal\block\Plugin\migrate\process\BlockRegion;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\block\Unit\Plugin\migrate\process\BlockVisibilityTest.
*/
namespace Drupal\Tests\block\Unit\Plugin\migrate\process;
use Drupal\block\Plugin\migrate\process\BlockVisibility;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\block\Unit\Plugin\migrate\source\BlockTest.
*/
namespace Drupal\Tests\block\Unit\Plugin\migrate\source;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;