Update to drupal-org-drupal 8.0.0-rc2. For more information, see https://www.drupal.org/node/2598668
This commit is contained in:
parent
f32e58e4b1
commit
8e18df8c36
3062 changed files with 15044 additions and 172506 deletions
|
@ -5,8 +5,6 @@
|
|||
* Provides views runtime hooks for action.module.
|
||||
*/
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
|
||||
/**
|
||||
* Implements hook_views_form_substitutions().
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* @file
|
||||
* Install, update and uninstall functions for the aggregator module.
|
||||
*/
|
||||
use Drupal\Core\Language\Language;
|
||||
|
||||
/**
|
||||
* Implements hook_requirements().
|
||||
|
|
|
@ -49,34 +49,6 @@ aggregator.feed_add:
|
|||
options:
|
||||
_admin_route: TRUE
|
||||
|
||||
entity.aggregator_feed.canonical:
|
||||
path: '/aggregator/sources/{aggregator_feed}'
|
||||
defaults:
|
||||
_entity_view: 'aggregator_feed'
|
||||
_title_callback: '\Drupal\aggregator\Controller\AggregatorController::feedTitle'
|
||||
requirements:
|
||||
_permission: 'access news feeds'
|
||||
|
||||
entity.aggregator_feed.edit_form:
|
||||
path: '/aggregator/sources/{aggregator_feed}/configure'
|
||||
defaults:
|
||||
_entity_form: 'aggregator_feed.default'
|
||||
_title: 'Configure'
|
||||
requirements:
|
||||
_permission: 'administer news feeds'
|
||||
options:
|
||||
_admin_route: TRUE
|
||||
|
||||
entity.aggregator_feed.delete_form:
|
||||
path: '/aggregator/sources/{aggregator_feed}/delete'
|
||||
defaults:
|
||||
_entity_form: 'aggregator_feed.delete'
|
||||
_title: 'Delete feed'
|
||||
requirements:
|
||||
_permission: 'administer news feeds'
|
||||
options:
|
||||
_admin_route: TRUE
|
||||
|
||||
aggregator.page_last:
|
||||
path: '/aggregator'
|
||||
defaults:
|
||||
|
|
|
@ -12,8 +12,6 @@ use Drupal\Core\Controller\ControllerBase;
|
|||
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
use Drupal\aggregator\FeedInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace Drupal\aggregator\Entity;
|
|||
use Drupal\Core\Entity\ContentEntityBase;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\aggregator\FeedInterface;
|
||||
|
||||
|
@ -30,7 +29,10 @@ use Drupal\aggregator\FeedInterface;
|
|||
* "default" = "Drupal\aggregator\FeedForm",
|
||||
* "delete" = "Drupal\aggregator\Form\FeedDeleteForm",
|
||||
* "delete_items" = "Drupal\aggregator\Form\FeedItemsDeleteForm",
|
||||
* }
|
||||
* },
|
||||
* "route_provider" = {
|
||||
* "html" = "Drupal\aggregator\FeedHtmlRouteProvider",
|
||||
* },
|
||||
* },
|
||||
* links = {
|
||||
* "canonical" = "/aggregator/sources/{aggregator_feed}",
|
||||
|
|
39
core/modules/aggregator/src/FeedHtmlRouteProvider.php
Normal file
39
core/modules/aggregator/src/FeedHtmlRouteProvider.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains Drupal\aggregator\FeedHtmlRouteProvider.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
||||
|
||||
/**
|
||||
* Provides HTML routes for the feed entity type.
|
||||
*/
|
||||
class FeedHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getCanonicalRoute(EntityTypeInterface $entity_type) {
|
||||
$route = parent::getCanonicalRoute($entity_type);
|
||||
$route->setDefault('_title_controller', '\Drupal\aggregator\Controller\AggregatorController::feedTitle');
|
||||
|
||||
return $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getEditFormRoute(EntityTypeInterface $entity_type) {
|
||||
$route = parent::getEditFormRoute($entity_type);
|
||||
|
||||
$route->setDefault('_title', 'Configure');
|
||||
|
||||
return $route;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\aggregator\FeedInterface;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\aggregator\Entity\Item;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityTypeInterface;
|
||||
use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
|
||||
|
|
|
@ -7,10 +7,8 @@
|
|||
|
||||
namespace Drupal\aggregator\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
use Drupal\Core\Field\FormatterBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Plugin implementation of the 'aggregator_xss' formatter.
|
||||
|
|
|
@ -12,7 +12,6 @@ use Drupal\aggregator\Plugin\AggregatorPluginSettingsBase;
|
|||
use Drupal\aggregator\Plugin\ProcessorInterface;
|
||||
use Drupal\aggregator\FeedInterface;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
use Drupal\Core\Entity\Query\QueryInterface;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
use Drupal\Component\Utility\Html;
|
||||
|
||||
/**
|
||||
* Add feed test.
|
||||
|
@ -62,8 +61,8 @@ class AddFeedTest extends AggregatorTestBase {
|
|||
$this->drupalGet('aggregator/sources/' . $feed->id());
|
||||
$this->assertResponse(200);
|
||||
|
||||
$result = $this->xpath('//h1');
|
||||
$this->assertEqual((string) $result[0], 'Test feed title alert(123);');
|
||||
$this->assertEscaped('Test feed title <script>alert(123);</script>');
|
||||
$this->assertNoRaw('Test feed title <script>alert(123);</script>');
|
||||
|
||||
// Ensure the feed icon title is escaped.
|
||||
$this->assertTrue(strpos(str_replace(["\n", "\r"], '', $this->getRawContent()), 'class="feed-icon"> Subscribe to Test feed title <script>alert(123);</script> feed</a>') !== FALSE);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Zend\Feed\Reader\Reader;
|
||||
|
||||
/**
|
||||
* Tests the built-in feed parser with valid feed samples.
|
||||
|
|
|
@ -13,11 +13,14 @@ use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
|||
/**
|
||||
* Test migration to aggregator_feed entities.
|
||||
*
|
||||
* @group aggregator
|
||||
* @group migrate_drupal_7
|
||||
*/
|
||||
class MigrateAggregatorFeedTest extends MigrateDrupal7TestBase {
|
||||
|
||||
public static $modules = array('aggregator');
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['aggregator'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -32,19 +35,25 @@ class MigrateAggregatorFeedTest extends MigrateDrupal7TestBase {
|
|||
* Tests migration of aggregator feeds.
|
||||
*/
|
||||
public function testAggregatorFeedImport() {
|
||||
/** @var \Drupal\aggregator\Entity\Feed $feed */
|
||||
/** @var \Drupal\aggregator\FeedInterface $feed */
|
||||
$feed = Feed::load(1);
|
||||
$this->assertIdentical('Know Your Meme', $feed->title->value);
|
||||
$this->assertIdentical('Know Your Meme', $feed->label());
|
||||
$this->assertIdentical('en', $feed->language()->getId());
|
||||
$this->assertIdentical('http://knowyourmeme.com/newsfeed.rss', $feed->url->value);
|
||||
$this->assertIdentical('900', $feed->refresh->value);
|
||||
$this->assertIdentical('1387659487', $feed->checked->value);
|
||||
$this->assertIdentical('0', $feed->queued->value);
|
||||
$this->assertIdentical('http://knowyourmeme.com/newsfeed.rss', $feed->getUrl());
|
||||
$this->assertIdentical('900', $feed->getRefreshRate());
|
||||
// The feed's last checked time can change as the fixture is updated, so
|
||||
// assert that its format is correct.
|
||||
$checked_time = $feed->getLastCheckedTime();
|
||||
$this->assertTrue(is_numeric($checked_time));
|
||||
$this->assertTrue($checked_time > 1000000000);
|
||||
$this->assertIdentical('0', $feed->getQueuedTime());
|
||||
$this->assertIdentical('http://knowyourmeme.com', $feed->link->value);
|
||||
$this->assertIdentical('New items added to the News Feed', $feed->description->value);
|
||||
$this->assertIdentical('http://b.thumbs.redditmedia.com/harEHsUUZVajabtC.png', $feed->image->value);
|
||||
$this->assertIdentical('"213cc1365b96c310e92053c5551f0504"', $feed->etag->value);
|
||||
$this->assertIdentical('0', $feed->modified->value);
|
||||
$this->assertIdentical('New items added to the News Feed', $feed->getDescription());
|
||||
$this->assertNull($feed->getImage());
|
||||
// As with getLastCheckedTime(), the etag can change as the fixture is
|
||||
// updated normally, so assert that its format is correct.
|
||||
$this->assertTrue(preg_match('/^"[a-z0-9]{32}"$/', $feed->getEtag()));
|
||||
$this->assertIdentical('0', $feed->getLastModified());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,11 +13,14 @@ use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
|||
/**
|
||||
* Tests migration of aggregator items.
|
||||
*
|
||||
* @group aggregator
|
||||
* @group migrate_drupal_7
|
||||
*/
|
||||
class MigrateAggregatorItemTest extends MigrateDrupal7TestBase {
|
||||
|
||||
public static $modules = array('aggregator');
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['aggregator'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -34,17 +37,27 @@ class MigrateAggregatorItemTest extends MigrateDrupal7TestBase {
|
|||
* Test Drupal 7 aggregator item migration to Drupal 8.
|
||||
*/
|
||||
public function testAggregatorItem() {
|
||||
/** @var \Drupal\aggregator\Entity\Item $item */
|
||||
$item = Item::load(1);
|
||||
$this->assertIdentical('1', $item->id());
|
||||
$this->assertIdentical('1', $item->getFeedId());
|
||||
$this->assertIdentical('This (three) weeks in Drupal Core - January 10th 2014', $item->label());
|
||||
$this->assertIdentical('larowlan', $item->getAuthor());
|
||||
$this->assertIdentical("<h2 id='new'>What's new with Drupal 8?</h2>", $item->getDescription());
|
||||
$this->assertIdentical('https://groups.drupal.org/node/395218', $item->getLink());
|
||||
$this->assertIdentical('1389297196', $item->getPostedTime());
|
||||
$this->assertIdentical('en', $item->language()->getId());
|
||||
$this->assertIdentical('395218 at https://groups.drupal.org', $item->getGuid());
|
||||
// Since the feed items can change as the fixture is updated normally,
|
||||
// assert all migrated feed items against the values in the fixture.
|
||||
$items = $this->sourceDatabase
|
||||
->select('aggregator_item', 'ai')
|
||||
->fields('ai')
|
||||
->execute();
|
||||
|
||||
foreach ($items as $original) {
|
||||
/** @var \Drupal\aggregator\ItemInterface $item */
|
||||
$item = Item::load($original->iid);
|
||||
$this->assertIdentical($original->fid, $item->getFeedId());
|
||||
$this->assertIdentical($original->title, $item->label());
|
||||
// If $original->author is an empty string, getAuthor() returns NULL so
|
||||
// we need to use assertEqual() here.
|
||||
$this->assertEqual($original->author, $item->getAuthor());
|
||||
$this->assertIdentical($original->description, $item->getDescription());
|
||||
$this->assertIdentical($original->link, $item->getLink());
|
||||
$this->assertIdentical($original->timestamp, $item->getPostedTime());
|
||||
$this->assertIdentical('en', $item->language()->getId());
|
||||
$this->assertIdentical($original->guid, $item->getGuid());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function ($, Drupal) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Filters the block list by a text input search string.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function ($, window) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Provide the summary information for the block settings vertical tabs.
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
namespace Drupal\block\Controller;
|
||||
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Controller for building the block instance add form.
|
||||
|
|
|
@ -9,10 +9,8 @@ namespace Drupal\block\Controller;
|
|||
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Drupal\Core\Extension\ThemeHandler;
|
||||
use Drupal\Core\Extension\ThemeHandlerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Controller routines for admin block routes.
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\block\EventSubscriber;
|
||||
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
use Drupal\Core\Render\PageDisplayVariantSelectionEvent;
|
||||
use Drupal\Core\Render\RenderEvents;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
|
|
@ -11,8 +11,6 @@ use Drupal\Component\Utility\Html;
|
|||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Drupal\block\Entity\Block;
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
namespace Drupal\block_test\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
|
||||
/**
|
||||
* Provides a block to test caching.
|
||||
|
|
|
@ -72,8 +72,8 @@ function block_content_entity_type_alter(array &$entity_types) {
|
|||
* @param string $label
|
||||
* (optional) The label for the body instance. Defaults to 'Body'
|
||||
*
|
||||
* @return array()
|
||||
* Body field.
|
||||
* @return \Drupal\field\Entity\FieldConfig
|
||||
* A Body field object.
|
||||
*/
|
||||
function block_content_add_body_field($block_type_id, $label = 'Body') {
|
||||
// Add or remove the body field, as needed.
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
*/
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\block_content\Entity\BlockContentType;
|
||||
use Drupal\block_content\Entity\BlockContent;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
/**
|
||||
* Prepares variables for a custom block type creation list templates.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function ($) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Sets summaries about revision and translation of block content.
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\block_content\Controller;
|
||||
|
||||
use Drupal\Component\Plugin\PluginManagerInterface;
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\block_content\BlockContentTypeInterface;
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
|
||||
namespace Drupal\block_content\Entity;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityBase;
|
||||
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\block_content\BlockContentTypeInterface;
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace Drupal\block_content\Form;
|
|||
use Drupal\Core\Entity\EntityDeleteForm;
|
||||
use Drupal\Core\Entity\Query\QueryFactory;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,6 @@ use Drupal\Core\Block\BlockManagerInterface;
|
|||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\Core\Routing\UrlGeneratorInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace Drupal\block_content\Tests;
|
|||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\system\Tests\Entity\EntityCacheTagsTestBase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\block_content\Tests;
|
||||
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace Drupal\block_content\Tests;
|
|||
|
||||
use Drupal\block_content\Entity\BlockContentType;
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* Ensures that custom block type functions work correctly.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function ($) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Adds summaries to the book outline form.
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
use Drupal\book\BookManager;
|
||||
use Drupal\book\BookManagerInterface;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Render\Element;
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
namespace Drupal\book;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Render\RendererInterface;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\node\NodeInterface;
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,6 @@ use Drupal\book\BookManagerInterface;
|
|||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Drupal\Core\Render\RendererInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\node\NodeInterface;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace Drupal\book\Form;
|
|||
use Drupal\book\BookManagerInterface;
|
||||
use Drupal\Core\Form\ConfirmFormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\node\NodeInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function ($, Drupal, _, CKEDITOR) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
Drupal.ckeditor = Drupal.ckeditor || {};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Provides the summary for the "drupalimage" plugin settings vertical tab.
|
||||
|
|
6
core/modules/ckeditor/js/ckeditor.js
vendored
6
core/modules/ckeditor/js/ckeditor.js
vendored
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function (Drupal, debounce, CKEDITOR, $) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @namespace
|
||||
|
@ -34,7 +34,7 @@
|
|||
// label so that screen readers say something that is understandable
|
||||
// for end users.
|
||||
var label = $('label[for=' + element.getAttribute('id') + ']').html();
|
||||
format.editorSettings.title = Drupal.t("Rich Text Editor, !label field", {'!label': label});
|
||||
format.editorSettings.title = Drupal.t('Rich Text Editor, !label field', {'!label': label});
|
||||
|
||||
return !!CKEDITOR.replace(element, format.editorSettings);
|
||||
},
|
||||
|
@ -249,7 +249,7 @@
|
|||
|
||||
// Moves the dialog to the top of the CKEDITOR stack.
|
||||
$(window).on('dialogcreate', function (e, dialog, $element, settings) {
|
||||
$('.ui-dialog--narrow').css("zIndex", CKEDITOR.config.baseFloatZIndex + 1);
|
||||
$('.ui-dialog--narrow').css('zIndex', CKEDITOR.config.baseFloatZIndex + 1);
|
||||
});
|
||||
|
||||
// Respond to new dialogs that are opened by CKEditor, closing the AJAX loader.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Ensures that the "stylescombo" button's metadata remains up-to-date.
|
||||
|
@ -66,8 +66,8 @@
|
|||
_generateStylesSetSetting: function (styles) {
|
||||
var stylesSet = [];
|
||||
|
||||
styles = styles.replace(/\r/g, "\n");
|
||||
var lines = styles.split("\n");
|
||||
styles = styles.replace(/\r/g, '\n');
|
||||
var lines = styles.split('\n');
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var style = $.trim(lines[i]);
|
||||
|
||||
|
@ -118,7 +118,7 @@
|
|||
return Drupal.t('No styles configured');
|
||||
}
|
||||
else {
|
||||
var count = $.trim(styles).split("\n").length;
|
||||
var count = $.trim(styles).split('\n').length;
|
||||
return Drupal.t('@count styles configured', {'@count': count});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function (Drupal, Backbone) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Backbone model for the CKEditor toolbar configuration state.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
(function ($, Drupal, CKEDITOR) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
CKEDITOR.plugins.add('drupalimage', {
|
||||
requires: 'image2',
|
||||
|
@ -32,6 +32,7 @@
|
|||
// Override requiredContent & allowedContent.
|
||||
widgetDefinition.requiredContent = new CKEDITOR.style({
|
||||
element: 'img',
|
||||
styles: {},
|
||||
attributes: {
|
||||
'alt': '',
|
||||
'src': '',
|
||||
|
@ -43,6 +44,7 @@
|
|||
});
|
||||
var allowedContentDefinition = {
|
||||
element: 'img',
|
||||
styles: {},
|
||||
attributes: {
|
||||
'!data-entity-type': '',
|
||||
'!data-entity-uuid': ''
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
(function (CKEDITOR) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
CKEDITOR.plugins.add('drupalimagecaption', {
|
||||
requires: 'drupalimage',
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
(function ($, Drupal, drupalSettings, CKEDITOR) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
CKEDITOR.plugins.add('drupallink', {
|
||||
init: function (editor) {
|
||||
|
@ -15,6 +15,7 @@
|
|||
editor.addCommand('drupallink', {
|
||||
allowedContent: new CKEDITOR.style({
|
||||
element: 'a',
|
||||
styles: {},
|
||||
attributes: {
|
||||
'!href': '',
|
||||
'target': ''
|
||||
|
@ -22,6 +23,7 @@
|
|||
}),
|
||||
requiredContent: new CKEDITOR.style({
|
||||
element: 'a',
|
||||
styles: {},
|
||||
attributes: {
|
||||
href: ''
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
(function (Drupal, Backbone, $) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
Drupal.ckeditor.AuralView = Backbone.View.extend(/** @lends Drupal.ckeditor.AuralView# */{
|
||||
|
||||
|
@ -104,8 +104,8 @@
|
|||
// If this position is the first in the last row then tell the user that
|
||||
// pressing the down arrow key will create a new row.
|
||||
if (position === 1 && row === rowCount) {
|
||||
text += "\n";
|
||||
text += Drupal.t("Press the down arrow key to create a new row.");
|
||||
text += '\n';
|
||||
text += Drupal.t('Press the down arrow key to create a new row.');
|
||||
}
|
||||
Drupal.announce(text, 'assertive');
|
||||
},
|
||||
|
@ -139,7 +139,7 @@
|
|||
'@name': $button.children().attr('aria-label'),
|
||||
'@type': type
|
||||
});
|
||||
text += "\n" + Drupal.t('Press the down arrow key to activate.');
|
||||
text += '\n' + Drupal.t('Press the down arrow key to activate.');
|
||||
|
||||
Drupal.announce(text, 'assertive');
|
||||
}
|
||||
|
@ -157,14 +157,14 @@
|
|||
// If this position is the first in the last row then tell the user that
|
||||
// pressing the down arrow key will create a new row.
|
||||
if (groupPosition === 1 && position === 1 && row === rowCount) {
|
||||
text += "\n";
|
||||
text += Drupal.t("Press the down arrow key to create a new button group in a new row.");
|
||||
text += '\n';
|
||||
text += Drupal.t('Press the down arrow key to create a new button group in a new row.');
|
||||
}
|
||||
// If this position is the last one in this row then tell the user that
|
||||
// moving the button to the next group will create a new group.
|
||||
if (groupPosition === groupPositionCount && position === positionCount) {
|
||||
text += "\n";
|
||||
text += Drupal.t("This is the last group. Move the button forward to create a new group.");
|
||||
text += '\n';
|
||||
text += Drupal.t('This is the last group. Move the button forward to create a new group.');
|
||||
}
|
||||
Drupal.announce(text, 'assertive');
|
||||
}
|
||||
|
@ -186,14 +186,14 @@
|
|||
message = Drupal.t('The "@name" button is currently enabled.', {
|
||||
'@name': $link.attr('aria-label')
|
||||
});
|
||||
message += "\n" + Drupal.t('Use the keyboard arrow keys to change the position of this button.');
|
||||
message += "\n" + Drupal.t('Press the up arrow key on the top row to disable the button.');
|
||||
message += '\n' + Drupal.t('Use the keyboard arrow keys to change the position of this button.');
|
||||
message += '\n' + Drupal.t('Press the up arrow key on the top row to disable the button.');
|
||||
}
|
||||
else {
|
||||
message = Drupal.t('The "@name" button is currently disabled.', {
|
||||
'@name': $link.attr('aria-label')
|
||||
});
|
||||
message += "\n" + Drupal.t('Use the down arrow key to move this button into the active toolbar.');
|
||||
message += '\n' + Drupal.t('Use the down arrow key to move this button into the active toolbar.');
|
||||
}
|
||||
Drupal.announce(message);
|
||||
event.preventDefault();
|
||||
|
@ -215,15 +215,15 @@
|
|||
message = Drupal.t('This @name is currently enabled.', {
|
||||
'@name': $link.attr('aria-label')
|
||||
});
|
||||
message += "\n" + Drupal.t('Use the keyboard arrow keys to change the position of this separator.');
|
||||
message += '\n' + Drupal.t('Use the keyboard arrow keys to change the position of this separator.');
|
||||
}
|
||||
else {
|
||||
message = Drupal.t('Separators are used to visually split individual buttons.');
|
||||
message += "\n" + Drupal.t('This @name is currently disabled.', {
|
||||
message += '\n' + Drupal.t('This @name is currently disabled.', {
|
||||
'@name': $link.attr('aria-label')
|
||||
});
|
||||
message += "\n" + Drupal.t('Use the down arrow key to move this separator into the active toolbar.');
|
||||
message += "\n" + Drupal.t('You may add multiple separators to each button group.');
|
||||
message += '\n' + Drupal.t('Use the down arrow key to move this separator into the active toolbar.');
|
||||
message += '\n' + Drupal.t('You may add multiple separators to each button group.');
|
||||
}
|
||||
Drupal.announce(message);
|
||||
event.preventDefault();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function (Drupal, Backbone, $) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
Drupal.ckeditor.ControllerView = Backbone.View.extend(/** @lends Drupal.ckeditor.ControllerView# */{
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function (Drupal, Backbone, $) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
Drupal.ckeditor.KeyboardView = Backbone.View.extend(/** @lends Drupal.ckeditor.KeyboardView# */{
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
(function (Drupal, Backbone, $) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
Drupal.ckeditor.VisualView = Backbone.View.extend(/** @lends Drupal.ckeditor.VisualView# */{
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
|
|||
|
||||
use Drupal\ckeditor\CKEditorPluginBase;
|
||||
use Drupal\ckeditor\CKEditorPluginConfigurableInterface;
|
||||
use Drupal\Component\Utility\NestedArray;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\ckeditor\Plugin\Editor;
|
||||
|
||||
use Drupal\Core\Cache\CacheBackendInterface;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\ckeditor\CKEditorPluginManager;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
namespace Drupal\ckeditor\Tests;
|
||||
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\ckeditor\CKEditorPluginManager;
|
||||
|
||||
/**
|
||||
* Tests different ways of enabling CKEditor plugins.
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
namespace Drupal\ckeditor_test\Plugin\CKEditorPlugin;
|
||||
|
||||
use Drupal\ckeditor\CKEditorPluginButtonsInterface;
|
||||
use Drupal\Component\Plugin\PluginBase;
|
||||
|
||||
/**
|
||||
* Defines a "LlamaButton" plugin, with a toolbar builder-enabled "llama" feature.
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
namespace Drupal\ckeditor_test\Plugin\CKEditorPlugin;
|
||||
|
||||
use Drupal\ckeditor\CKEditorPluginContextualInterface;
|
||||
use Drupal\Component\Plugin\PluginBase;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace Drupal\ckeditor_test\Plugin\CKEditorPlugin;
|
|||
use Drupal\ckeditor\CKEditorPluginButtonsInterface;
|
||||
use Drupal\ckeditor\CKEditorPluginContextualInterface;
|
||||
use Drupal\ckeditor\CKEditorPluginConfigurableInterface;
|
||||
use Drupal\Component\Plugin\PluginBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function ($) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Displays farbtastic color selector and initialize color administration UI.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function ($) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Namespace for color-related functionality for Drupal.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Adds javascript functions for font resizing.
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
$(document).ready(function () {});
|
||||
})(jQuery);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function ($) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
|
|
|
@ -11,24 +11,17 @@
|
|||
*/
|
||||
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\comment\Entity\Comment;
|
||||
use Drupal\comment\CommentManagerInterface;
|
||||
use Drupal\comment\Entity\CommentType;
|
||||
use Drupal\Core\Entity\FieldableEntityInterface;
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\Core\Entity\Entity\EntityViewDisplay;
|
||||
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
|
||||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
use Drupal\Core\Render\Element;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\field\FieldConfigInterface;
|
||||
use Drupal\field\FieldStorageConfigInterface;
|
||||
use Drupal\file\FileInterface;
|
||||
use Drupal\user\EntityOwnerInterface;
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\user\RoleInterface;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Add 'by-viewer' class to comments written by the current user.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
(function ($, Drupal, window) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Renders "new" comment indicators wherever necessary.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
(function ($, Drupal) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Render "X new comments" links wherever necessary.
|
||||
|
|
|
@ -20,7 +20,18 @@ process:
|
|||
0: comment_no_subject
|
||||
bundle: node_type
|
||||
'default_value/0/status': comment
|
||||
'settings/default_mode': comment_default_mode
|
||||
'settings/default_mode':
|
||||
plugin: static_map
|
||||
source: comment_default_mode
|
||||
map:
|
||||
# COMMENT_MODE_FLAT_COLLAPSED --> COMMENT_MODE_FLAT
|
||||
1: 0
|
||||
# COMMENT_MODE_FLAT_EXPANDED --> COMMENT_MODE_FLAT
|
||||
2: 0
|
||||
# COMMENT_MODE_THREADED_COLLAPSED --> COMMENT_MODE_THREADED
|
||||
3: 1
|
||||
# COMMENT_MODE_THREADED_EXPANDED --> COMMENT_MODE_THREADED
|
||||
4: 1
|
||||
'settings/per_page': comment_default_per_page
|
||||
'settings/anonymous': comment_anonymous
|
||||
'settings/form_location': comment_form_location
|
||||
|
|
|
@ -10,13 +10,11 @@ namespace Drupal\comment;
|
|||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Datetime\DrupalDateTime;
|
||||
use Drupal\Core\Entity\ContentEntityForm;
|
||||
use Drupal\Core\Entity\EntityConstraintViolationListInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\Core\Render\RendererInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
@ -265,7 +263,7 @@ class CommentForm extends ContentEntityForm {
|
|||
public function buildEntity(array $form, FormStateInterface $form_state) {
|
||||
/** @var \Drupal\comment\CommentInterface $comment */
|
||||
$comment = parent::buildEntity($form, $form_state);
|
||||
if (!$form_state->isValueEmpty('date') && $form_state->getValue('date') instanceOf DrupalDateTime) {
|
||||
if (!$form_state->isValueEmpty('date') && $form_state->getValue('date') instanceof DrupalDateTime) {
|
||||
$comment->setCreatedTime($form_state->getValue('date')->getTimestamp());
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -208,7 +208,7 @@ class CommentLinkBuilder implements CommentLinkBuilderInterface {
|
|||
if ($new_comments > 0) {
|
||||
$page_number = $this->entityManager
|
||||
->getStorage('comment')
|
||||
->getNewCommentPageNumber($entity->{$field_name}->comment_count, $new_comments, $entity);
|
||||
->getNewCommentPageNumber($entity->{$field_name}->comment_count, $new_comments, $entity, $field_name);
|
||||
$query = $page_number ? ['page' => $page_number] : NULL;
|
||||
$value = [
|
||||
'new_comment_count' => (int) $new_comments,
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
|
||||
/**
|
||||
* Comment manager contains common functions to manage comment fields.
|
||||
|
|
|
@ -135,7 +135,7 @@ class CommentStorage extends SqlContentEntityStorage implements CommentStorageIn
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getNewCommentPageNumber($total_comments, $new_comments, FieldableEntityInterface $entity, $field_name = 'comment') {
|
||||
public function getNewCommentPageNumber($total_comments, $new_comments, FieldableEntityInterface $entity, $field_name) {
|
||||
$field = $entity->getFieldDefinition($field_name);
|
||||
$comments_per_page = $field->getSetting('per_page');
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ interface CommentStorageInterface extends EntityStorageInterface {
|
|||
* @return array|null
|
||||
* The page number where first new comment appears. (First page returns 0.)
|
||||
*/
|
||||
public function getNewCommentPageNumber($total_comments, $new_comments, FieldableEntityInterface $entity, $field_name = 'comment');
|
||||
public function getNewCommentPageNumber($total_comments, $new_comments, FieldableEntityInterface $entity, $field_name);
|
||||
|
||||
/**
|
||||
* Gets the display ordinal or page number for a comment.
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityTypeInterface;
|
||||
use Drupal\Core\Entity\EntityForm;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\comment;
|
||||
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
|
|
@ -335,7 +335,7 @@ class CommentController extends ControllerBase {
|
|||
$node = $this->entityManager->getStorage('node')->load($nid);
|
||||
$new = $this->commentManager->getCountNewComments($node);
|
||||
$page_number = $this->entityManager()->getStorage('comment')
|
||||
->getNewCommentPageNumber($node->{$field_name}->comment_count, $new, $node);
|
||||
->getNewCommentPageNumber($node->{$field_name}->comment_count, $new, $node, $field_name);
|
||||
$query = $page_number ? array('page' => $page_number) : NULL;
|
||||
$links[$nid] = array(
|
||||
'new_comment_count' => (int) $new,
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
namespace Drupal\comment\Entity;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\comment\CommentTypeInterface;
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,6 @@ use Drupal\Core\Entity\EntityDeleteForm;
|
|||
use Drupal\Core\Entity\EntityManager;
|
||||
use Drupal\Core\Entity\Query\QueryFactory;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
|
|
@ -7,12 +7,8 @@
|
|||
|
||||
namespace Drupal\comment\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\comment\CommentManagerInterface;
|
||||
use Drupal\comment\CommentStorageInterface;
|
||||
use Drupal\comment\Entity\Comment;
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Entity\EntityViewBuilderInterface;
|
||||
use Drupal\Core\Entity\EntityFormBuilderInterface;
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -161,12 +161,28 @@ class NodeNewComments extends NumericField {
|
|||
*/
|
||||
protected function renderLink($data, ResultRow $values) {
|
||||
if (!empty($this->options['link_to_comment']) && $data !== NULL && $data !== '') {
|
||||
$node_type = $this->getValue($values, 'type');
|
||||
$node = entity_create('node', array(
|
||||
'nid' => $this->getValue($values, 'nid'),
|
||||
'type' => $this->getValue($values, 'type'),
|
||||
'type' => $node_type,
|
||||
));
|
||||
$page_number = \Drupal::entityManager()->getStorage('comment')
|
||||
->getNewCommentPageNumber($this->getValue($values, 'comment_count'), $this->getValue($values), $node);
|
||||
// Because there is no support for selecting a specific comment field to
|
||||
// reference, we arbitrarily use the first such field name we find.
|
||||
// @todo Provide a means for selecting the comment field.
|
||||
// https://www.drupal.org/node/2594201
|
||||
$entity_manager = \Drupal::entityManager();
|
||||
$field_map = $entity_manager->getFieldMapByFieldType('comment');
|
||||
$comment_field_name = 'comment';
|
||||
foreach ($field_map['node'] as $field_name => $field_data) {
|
||||
foreach ($field_data['bundles'] as $bundle_name) {
|
||||
if ($node_type == $bundle_name) {
|
||||
$comment_field_name = $field_name;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
$page_number = $entity_manager->getStorage('comment')
|
||||
->getNewCommentPageNumber($this->getValue($values, 'comment_count'), $this->getValue($values), $node, $comment_field_name);
|
||||
$this->options['alter']['make_link'] = TRUE;
|
||||
$this->options['alter']['url'] = $node->urlInfo();
|
||||
$this->options['alter']['query'] = $page_number ? array('page' => $page_number) : NULL;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\comment\Plugin\views\wizard;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\views\Plugin\views\wizard\WizardPluginBase;
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
namespace Drupal\comment\Tests;
|
||||
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Session\UserSession;
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\system\Tests\Entity\EntityUnitTestBase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
|
|
@ -243,7 +243,7 @@ class CommentFieldAccessTest extends EntityUnitTestBase {
|
|||
foreach ($permutations as $set) {
|
||||
$may_view = $set['comment']->{$field}->access('view', $set['user']);
|
||||
$may_update = $set['comment']->{$field}->access('edit', $set['user']);
|
||||
// Nobody has access to to view the hostname field.
|
||||
// Nobody has access to view the hostname field.
|
||||
if ($field === 'hostname') {
|
||||
$view_access = FALSE;
|
||||
$state = 'cannot';
|
||||
|
|
|
@ -94,6 +94,55 @@ class CommentFieldsTest extends CommentTestBase {
|
|||
$this->assertEqual(1, count($elements), 'There is one comment field on the node.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests link building with non-default comment field names.
|
||||
*/
|
||||
public function testCommentFieldLinksNonDefaultName() {
|
||||
$this->drupalCreateContentType(['type' => 'test_node_type']);
|
||||
$this->addDefaultCommentField('node', 'test_node_type', 'comment2');
|
||||
|
||||
$web_user2 = $this->drupalCreateUser([
|
||||
'access comments',
|
||||
'post comments',
|
||||
'create article content',
|
||||
'edit own comments',
|
||||
'skip comment approval',
|
||||
'access content',
|
||||
]);
|
||||
|
||||
// Create a sample node.
|
||||
$node = $this->drupalCreateNode([
|
||||
'title' => 'Baloney',
|
||||
'type' => 'test_node_type',
|
||||
]);
|
||||
|
||||
// Go to the node first so that webuser2 see new comments.
|
||||
$this->drupalLogin($web_user2);
|
||||
$this->drupalGet($node->urlInfo());
|
||||
$this->drupalLogout();
|
||||
|
||||
// Test that buildCommentedEntityLinks() does not break when the 'comment'
|
||||
// field does not exist. Requires at least one comment.
|
||||
$this->drupalLogin($this->webUser);
|
||||
$this->postComment($node, 'Here is a comment', '', NULL, 'comment2');
|
||||
$this->drupalLogout();
|
||||
|
||||
$this->drupalLogin($web_user2);
|
||||
|
||||
// We want to check the attached drupalSettings of
|
||||
// \Drupal\comment\CommentLinkBuilder::buildCommentedEntityLinks. Therefore
|
||||
// we need a node listing, let's use views for that.
|
||||
$this->container->get('module_installer')->install(['views'], TRUE);
|
||||
// We also need a router rebuild, as the router is lazily rebuild in the
|
||||
// module installer.
|
||||
\Drupal::service('router.builder')->rebuild();
|
||||
$this->drupalGet('node');
|
||||
|
||||
$link_info = $this->getDrupalSettings()['comment']['newCommentsLinks']['node']['comment2']['2'];
|
||||
$this->assertIdentical($link_info['new_comment_count'], 1);
|
||||
$this->assertIdentical($link_info['first_new_comment_link'], $node->url('canonical', ['fragment' => 'new']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests creating a comment field through the interface.
|
||||
*/
|
||||
|
|
|
@ -435,7 +435,7 @@ class CommentNonNodeTest extends WebTestBase {
|
|||
$data = array('bundle' => 'entity_test', 'name' => $random_label);
|
||||
$new_entity = entity_create('entity_test', $data);
|
||||
$new_entity->save();
|
||||
$this->drupalGet('entity_test/manage/' . $new_entity->id());
|
||||
$this->drupalGet('entity_test/manage/' . $new_entity->id() . '/edit');
|
||||
$this->assertNoFieldChecked('edit-field-foobar-0-status-1');
|
||||
$this->assertFieldChecked('edit-field-foobar-0-status-2');
|
||||
$this->assertNoField('edit-field-foobar-0-status-0');
|
||||
|
|
|
@ -250,7 +250,7 @@ class CommentPagerTest extends CommentTestBase {
|
|||
$node = Node::load($node->id());
|
||||
foreach ($expected_pages as $new_replies => $expected_page) {
|
||||
$returned_page = \Drupal::entityManager()->getStorage('comment')
|
||||
->getNewCommentPageNumber($node->get('comment')->comment_count, $new_replies, $node);
|
||||
->getNewCommentPageNumber($node->get('comment')->comment_count, $new_replies, $node, 'comment');
|
||||
$this->assertIdentical($expected_page, $returned_page, format_string('Flat mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ class CommentPagerTest extends CommentTestBase {
|
|||
$node = Node::load($node->id());
|
||||
foreach ($expected_pages as $new_replies => $expected_page) {
|
||||
$returned_page = \Drupal::entityManager()->getStorage('comment')
|
||||
->getNewCommentPageNumber($node->get('comment')->comment_count, $new_replies, $node);
|
||||
->getNewCommentPageNumber($node->get('comment')->comment_count, $new_replies, $node, 'comment');
|
||||
$this->assertEqual($expected_page, $returned_page, format_string('Threaded mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace Drupal\comment\Tests;
|
|||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\UrlHelper;
|
||||
use Drupal\Component\Utility\Xss;
|
||||
use Drupal\comment\Entity\Comment;
|
||||
use Drupal\Core\Render\BubbleableMetadata;
|
||||
use Drupal\node\Entity\Node;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
namespace Drupal\comment\Tests\Migrate\d6;
|
||||
|
||||
use Drupal\comment\CommentManagerInterface;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\node\Entity\Node;
|
||||
|
||||
|
@ -44,21 +45,21 @@ class MigrateCommentVariableInstanceTest extends MigrateDrupal6TestBase {
|
|||
$this->assertIdentical(0, $node->comment->status);
|
||||
$this->assertIdentical('comment', $node->comment->getFieldDefinition()->getName());
|
||||
$settings = $node->comment->getFieldDefinition()->getSettings();
|
||||
$this->assertIdentical(4, $settings['default_mode']);
|
||||
$this->assertIdentical(CommentManagerInterface::COMMENT_MODE_THREADED, $settings['default_mode']);
|
||||
$this->assertIdentical(50, $settings['per_page']);
|
||||
$this->assertIdentical(0, $settings['anonymous']);
|
||||
$this->assertIdentical(FALSE, $settings['form_location']);
|
||||
$this->assertIdentical(1, $settings['preview']);
|
||||
$this->assertFalse($settings['anonymous']);
|
||||
$this->assertFalse($settings['form_location']);
|
||||
$this->assertTrue($settings['preview']);
|
||||
|
||||
$node = Node::create(['type' => 'story']);
|
||||
$this->assertIdentical(2, $node->comment_no_subject->status);
|
||||
$this->assertIdentical('comment_no_subject', $node->comment_no_subject->getFieldDefinition()->getName());
|
||||
$settings = $node->comment_no_subject->getFieldDefinition()->getSettings();
|
||||
$this->assertIdentical(2, $settings['default_mode']);
|
||||
$this->assertIdentical(CommentManagerInterface::COMMENT_MODE_FLAT, $settings['default_mode']);
|
||||
$this->assertIdentical(70, $settings['per_page']);
|
||||
$this->assertIdentical(1, $settings['anonymous']);
|
||||
$this->assertIdentical(FALSE, $settings['form_location']);
|
||||
$this->assertIdentical(0, $settings['preview']);
|
||||
$this->assertTrue($settings['anonymous']);
|
||||
$this->assertFalse($settings['form_location']);
|
||||
$this->assertFalse($settings['preview']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ use Drupal\comment\CommentInterface;
|
|||
use Drupal\comment\Entity\Comment;
|
||||
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\user\Entity\User;
|
||||
|
||||
/**
|
||||
* Tests migration of comments from Drupal 7.
|
||||
|
@ -37,12 +36,6 @@ class MigrateCommentTest extends MigrateDrupal7TestBase {
|
|||
'd7_user_role',
|
||||
'd7_user',
|
||||
]);
|
||||
// The test database doesn't include uid 1, so we'll need to create it.
|
||||
User::create(array(
|
||||
'uid' => 1,
|
||||
'name' => 'admin',
|
||||
'mail' => 'admin@local.host',
|
||||
))->save();
|
||||
$this->executeMigration('d7_node_type');
|
||||
// We only need the test_content_type node migration to run for real, so
|
||||
// mock all the others.
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* markup in edge case scenarios where comments have empty titles.
|
||||
*/
|
||||
|
||||
use Drupal\comment\CommentInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_comment().
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
namespace Drupal\Tests\comment\Unit\Entity;
|
||||
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
use Drupal\Core\Entity\EntityType;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace Drupal\config;
|
|||
|
||||
use Drupal\Core\Config\ConfigEvents;
|
||||
use Drupal\Core\Config\ConfigImporterEvent;
|
||||
use Drupal\Core\Config\ConfigImporterException;
|
||||
use Drupal\Core\Config\ConfigImportValidateEventSubscriberBase;
|
||||
|
||||
|
||||
|
|
|
@ -7,11 +7,9 @@
|
|||
|
||||
namespace Drupal\config\Form;
|
||||
|
||||
use Drupal\Component\Uuid\UuidInterface;
|
||||
use Drupal\Core\Config\ConfigImporterException;
|
||||
use Drupal\Core\Config\ConfigImporter;
|
||||
use Drupal\Core\Config\TypedConfigManagerInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\Core\Extension\ModuleInstallerInterface;
|
||||
use Drupal\Core\Extension\ThemeHandlerInterface;
|
||||
|
|
|
@ -12,7 +12,6 @@ use Drupal\Core\Config\ConfigNameException;
|
|||
use Drupal\Core\Config\ConfigValueException;
|
||||
use Drupal\Core\Config\InstallStorage;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\Core\Config\FileStorage;
|
||||
use Drupal\Core\Config\DatabaseStorage;
|
||||
use Drupal\Core\Config\UnsupportedDataTypeConfigException;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\config\Tests;
|
||||
|
||||
use Drupal\Core\Entity\EntityMalformedException;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\config\Tests;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
|
||||
namespace Drupal\config\Tests;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Config\ConfigImporter;
|
||||
use Drupal\Core\Config\ConfigImporterException;
|
||||
use Drupal\Core\Config\StorageComparer;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace Drupal\config\Tests;
|
|||
|
||||
use Drupal\Core\Config\InstallStorage;
|
||||
use Drupal\Core\Config\PreExistingConfigException;
|
||||
use Drupal\Core\Config\StorageInterface;
|
||||
use Drupal\Core\Config\UnmetDependenciesException;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace Drupal\config\Tests;
|
|||
|
||||
use Drupal\config_test\TestInstallStorage;
|
||||
use Drupal\Core\Config\InstallStorage;
|
||||
use Drupal\Core\Config\TypedConfigManager;
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\config\Tests;
|
||||
|
||||
use Drupal\Core\Config\Schema\SchemaCheckTrait;
|
||||
use Drupal\Core\Config\Schema\SchemaIncompleteException;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
|
||||
namespace Drupal\config\Tests;
|
||||
|
||||
use Drupal\Core\Config\Schema\SchemaCheckTrait;
|
||||
use Drupal\Core\Config\Schema\SchemaIncompleteException;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace Drupal\config\Tests\Storage;
|
|||
|
||||
use Drupal\Core\Config\FileStorage;
|
||||
use Drupal\Core\Config\CachedStorage;
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue