Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions

View file

@ -7,6 +7,7 @@
namespace Drupal\block\Controller;
use Drupal\Component\Utility\Html;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Extension\ThemeHandler;
use Drupal\Core\Extension\ThemeHandlerInterface;
@ -55,7 +56,7 @@ class BlockController extends ControllerBase {
*/
public function demo($theme) {
$page = [
'#title' => $this->themeHandler->getName($theme),
'#title' => Html::escape($this->themeHandler->getName($theme)),
'#type' => 'page',
'#attached' => array(
'drupalSettings' => [

View file

@ -12,6 +12,7 @@ use Drupal\Core\Block\BlockManagerInterface;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\Core\Menu\LocalActionManagerInterface;
use Drupal\Core\Plugin\Context\LazyContextRepository;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -29,6 +30,13 @@ class BlockLibraryController extends ControllerBase {
*/
protected $blockManager;
/**
* The context repository.
*
* @var \Drupal\Core\Plugin\Context\LazyContextRepository
*/
protected $contextRepository;
/**
* The route match.
*
@ -48,15 +56,18 @@ class BlockLibraryController extends ControllerBase {
*
* @param \Drupal\Core\Block\BlockManagerInterface $block_manager
* The block manager.
* @param \Drupal\Core\Plugin\Context\LazyContextRepository $context_repository
* The context repository.
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The current route match.
* @param \Drupal\Core\Menu\LocalActionManagerInterface $local_action_manager
* The local action manager.
*/
public function __construct(BlockManagerInterface $block_manager, RouteMatchInterface $route_match, LocalActionManagerInterface $local_action_manager) {
public function __construct(BlockManagerInterface $block_manager, LazyContextRepository $context_repository, RouteMatchInterface $route_match, LocalActionManagerInterface $local_action_manager) {
$this->blockManager = $block_manager;
$this->routeMatch = $route_match;
$this->localActionManager = $local_action_manager;
$this->contextRepository = $context_repository;
}
/**
@ -65,6 +76,7 @@ class BlockLibraryController extends ControllerBase {
public static function create(ContainerInterface $container) {
return new static(
$container->get('plugin.manager.block'),
$container->get('context.repository'),
$container->get('current_route_match'),
$container->get('plugin.manager.menu.local_action')
);
@ -95,7 +107,7 @@ class BlockLibraryController extends ControllerBase {
];
// Only add blocks which work without any available context.
$definitions = $this->blockManager->getDefinitionsForContexts();
$definitions = $this->blockManager->getDefinitionsForContexts($this->contextRepository->getAvailableContexts());
// Order by category, and then by admin label.
$definitions = $this->blockManager->getSortedDefinitions($definitions);
@ -104,9 +116,11 @@ class BlockLibraryController extends ControllerBase {
foreach ($definitions as $plugin_id => $plugin_definition) {
$row = [];
$row['title']['data'] = [
'#markup' => $plugin_definition['admin_label'],
'#prefix' => '<div class="block-filter-text-source">',
'#suffix' => '</div>',
'#type' => 'inline_template',
'#template' => '<div class="block-filter-text-source">{{ label }}</div>',
'#context' => [
'label' => $plugin_definition['admin_label'],
],
];
$row['category']['data'] = $plugin_definition['category'];
$links['add'] = [

View file

@ -7,8 +7,8 @@
namespace Drupal\block\Controller;
use Drupal\Component\Utility\Html;
use Drupal\Core\Block\BlockManagerInterface;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
@ -59,7 +59,7 @@ class CategoryAutocompleteController implements ContainerInjectionInterface {
$matches = array();
foreach ($this->blockManager->getCategories() as $category) {
if (stripos($category, $typed_category) === 0) {
$matches[] = array('value' => $category, 'label' => SafeMarkup::checkPlain($category));
$matches[] = array('value' => $category, 'label' => Html::escape($category));
}
}
return new JsonResponse($matches);