Update to Drupal 8.1.1. For more information, see https://www.drupal.org/node/2718713
This commit is contained in:
parent
c0a0d5a94c
commit
9eae24d844
669 changed files with 3873 additions and 1553 deletions
|
@ -55,7 +55,8 @@ class EmailAction extends ConfigurableActionBase implements ContainerFactoryPlug
|
|||
*/
|
||||
protected $mailManager;
|
||||
|
||||
/** The language manager.
|
||||
/**
|
||||
* The language manager.
|
||||
*
|
||||
* @var \Drupal\Core\Language\LanguageManagerInterface
|
||||
*/
|
||||
|
|
|
@ -50,7 +50,7 @@ function aggregator_help($route_name, RouteMatchInterface $route_match) {
|
|||
case 'aggregator.admin_overview':
|
||||
// Don't use placeholders for possibility to change URLs for translators.
|
||||
$output = '<p>' . t('Many sites publish their headlines and posts in feeds, using a number of standardized XML-based formats. The aggregator supports <a href="http://en.wikipedia.org/wiki/Rss">RSS</a>, <a href="http://en.wikipedia.org/wiki/Resource_Description_Framework">RDF</a>, and <a href="http://en.wikipedia.org/wiki/Atom_%28standard%29">Atom</a>.') . '</p>';
|
||||
$output .= '<p>' . t('Current feeds are listed below, and <a href=":addfeed">new feeds may be added</a>. For each feed, the <em>latest items</em> block may be enabled at the <a href=":block">blocks administration page</a>.', array(':addfeed' => \Drupal::url('aggregator.feed_add'), ':block' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '</p>';
|
||||
$output .= '<p>' . t('Current feeds are listed below, and <a href=":addfeed">new feeds may be added</a>. For each feed, the <em>latest items</em> block may be enabled at the <a href=":block">blocks administration page</a>.', array(':addfeed' => \Drupal::url('aggregator.feed_add'), ':block' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '</p>';
|
||||
return $output;
|
||||
|
||||
case 'aggregator.feed_add':
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Drupal\aggregator\Tests;
|
|||
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
use Drupal\aggregator\Entity\Item;
|
||||
use Drupal\Core\Cache\CacheBackendInterface;
|
||||
use Drupal\system\Tests\Entity\EntityCacheTagsTestBase;
|
||||
use Drupal\user\Entity\Role;
|
||||
use Drupal\user\RoleInterface;
|
||||
|
@ -63,7 +64,7 @@ class ItemCacheTagsTest extends EntityCacheTagsTestBase {
|
|||
*/
|
||||
public function testEntityCreation() {
|
||||
// Create a cache entry that is tagged with a feed cache tag.
|
||||
\Drupal::cache('render')->set('foo', 'bar', \Drupal\Core\Cache\CacheBackendInterface::CACHE_PERMANENT, $this->entity->getCacheTags());
|
||||
\Drupal::cache('render')->set('foo', 'bar', CacheBackendInterface::CACHE_PERMANENT, $this->entity->getCacheTags());
|
||||
|
||||
// Verify a cache hit.
|
||||
$this->verifyRenderCache('foo', array('aggregator_feed:1'));
|
||||
|
|
|
@ -75,7 +75,7 @@ class AggregatorTitleTest extends KernelTestBase {
|
|||
$this->assertNotContains($aggregator_feed->getUrl(), $result);
|
||||
|
||||
// Verify aggregator item title with and without links.
|
||||
$build = $aggregator_item->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' =>TRUE]]);
|
||||
$build = $aggregator_item->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => TRUE]]);
|
||||
$result = $this->render($build);
|
||||
|
||||
$this->assertContains('test title', $result);
|
||||
|
|
|
@ -11,7 +11,7 @@ services:
|
|||
- { name: placeholder_strategy, priority: 0 }
|
||||
big_pipe:
|
||||
class: Drupal\big_pipe\Render\BigPipe
|
||||
arguments: ['@renderer', '@session', '@request_stack', '@http_kernel', '@event_dispatcher']
|
||||
arguments: ['@renderer', '@session', '@request_stack', '@http_kernel', '@event_dispatcher', '@config.factory']
|
||||
html_response.attachments_processor.big_pipe:
|
||||
public: false
|
||||
class: \Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor
|
||||
|
|
|
@ -8,6 +8,7 @@ use Drupal\Core\Ajax\AjaxResponse;
|
|||
use Drupal\Core\Ajax\ReplaceCommand;
|
||||
use Drupal\Core\Asset\AttachedAssets;
|
||||
use Drupal\Core\Asset\AttachedAssetsInterface;
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
use Drupal\Core\Render\HtmlResponse;
|
||||
use Drupal\Core\Render\RendererInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
@ -73,6 +74,13 @@ class BigPipe implements BigPipeInterface {
|
|||
*/
|
||||
protected $eventDispatcher;
|
||||
|
||||
/**
|
||||
* The config factory.
|
||||
*
|
||||
* @var \Drupal\Core\Config\ConfigFactoryInterface
|
||||
*/
|
||||
protected $configFactory;
|
||||
|
||||
/**
|
||||
* Constructs a new BigPipe class.
|
||||
*
|
||||
|
@ -86,13 +94,16 @@ class BigPipe implements BigPipeInterface {
|
|||
* The HTTP kernel.
|
||||
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
|
||||
* The event dispatcher.
|
||||
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
|
||||
* The config factory.
|
||||
*/
|
||||
public function __construct(RendererInterface $renderer, SessionInterface $session, RequestStack $request_stack, HttpKernelInterface $http_kernel, EventDispatcherInterface $event_dispatcher) {
|
||||
public function __construct(RendererInterface $renderer, SessionInterface $session, RequestStack $request_stack, HttpKernelInterface $http_kernel, EventDispatcherInterface $event_dispatcher, ConfigFactoryInterface $config_factory) {
|
||||
$this->renderer = $renderer;
|
||||
$this->session = $session;
|
||||
$this->requestStack = $request_stack;
|
||||
$this->httpKernel = $http_kernel;
|
||||
$this->eventDispatcher = $event_dispatcher;
|
||||
$this->configFactory = $config_factory;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -243,7 +254,7 @@ class BigPipe implements BigPipeInterface {
|
|||
$elements = $this->renderPlaceholder($placeholder, $placeholder_plus_cumulative_settings);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
|
||||
if ($this->configFactory->get('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
|
||||
throw $e;
|
||||
}
|
||||
else {
|
||||
|
@ -280,7 +291,7 @@ class BigPipe implements BigPipeInterface {
|
|||
$html_response = $this->filterEmbeddedResponse($fake_request, $html_response);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
|
||||
if ($this->configFactory->get('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
|
||||
throw $e;
|
||||
}
|
||||
else {
|
||||
|
@ -355,7 +366,7 @@ class BigPipe implements BigPipeInterface {
|
|||
$elements = $this->renderPlaceholder($placeholder_id, $placeholder_render_array);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
|
||||
if ($this->configFactory->get('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
|
||||
throw $e;
|
||||
}
|
||||
else {
|
||||
|
@ -388,7 +399,7 @@ class BigPipe implements BigPipeInterface {
|
|||
$ajax_response = $this->filterEmbeddedResponse($fake_request, $ajax_response);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
|
||||
if ($this->configFactory->get('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
|
||||
throw $e;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -105,12 +105,19 @@ class BigPipeStrategy implements PlaceholderStrategyInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function processPlaceholders(array $placeholders) {
|
||||
$request = $this->requestStack->getCurrentRequest();
|
||||
|
||||
// @todo remove this check when https://www.drupal.org/node/2367555 lands.
|
||||
if (!$request->isMethodSafe()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Routes can opt out from using the BigPipe HTML delivery technique.
|
||||
if ($this->routeMatch->getRouteObject()->getOption('_no_big_pipe')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (!$this->sessionConfiguration->hasSession($this->requestStack->getCurrentRequest())) {
|
||||
if (!$this->sessionConfiguration->hasSession($request)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace Drupal\big_pipe\Tests;
|
|||
|
||||
use Drupal\big_pipe\Render\BigPipeMarkup;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
|
||||
use Drupal\Core\Url;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
|
@ -93,7 +94,7 @@ class BigPipePlaceholderTestCases {
|
|||
'theme' => 'classy',
|
||||
'libraries' => 'big_pipe/big_pipe,classy/base,classy/messages,core/drupal.active-link,core/html5shiv,core/normalize,system/base',
|
||||
],
|
||||
'pluralDelimiter' => \Drupal\Core\StringTranslation\PluralTranslatableMarkup::DELIMITER,
|
||||
'pluralDelimiter' => PluralTranslatableMarkup::DELIMITER,
|
||||
'user' => [
|
||||
'uid' => '1',
|
||||
'permissionsHash' => $container->get('user_permissions_hash_generator')->generate($user),
|
||||
|
|
|
@ -361,7 +361,7 @@ class BigPipeTest extends WebTestBase {
|
|||
$csrf_token_seed = unserialize(explode('_sf2_meta|', $session_data)[1])['s'];
|
||||
$this->container->get('session_manager.metadata_bag')->setCsrfTokenSeed($csrf_token_seed);
|
||||
|
||||
return \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases::cases($this->container, $this->rootUser);
|
||||
return BigPipePlaceholderTestCases::cases($this->container, $this->rootUser);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Drupal\big_pipe_test;
|
||||
|
||||
use Drupal\big_pipe\Render\BigPipeMarkup;
|
||||
use Drupal\big_pipe\Tests\BigPipePlaceholderTestCases;
|
||||
use Drupal\big_pipe_test\EventSubscriber\BigPipeTestSubscriber;
|
||||
|
||||
class BigPipeTestController {
|
||||
|
@ -15,7 +16,7 @@ class BigPipeTestController {
|
|||
public function test() {
|
||||
$build = [];
|
||||
|
||||
$cases = \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases::cases(\Drupal::getContainer());
|
||||
$cases = BigPipePlaceholderTestCases::cases(\Drupal::getContainer());
|
||||
|
||||
// 1. HTML placeholder: status messages. Drupal renders those automatically,
|
||||
// so all that we need to do in this controller is set a message.
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Drupal\Tests\big_pipe\Unit\Render\Placeholder;
|
||||
|
||||
use Drupal\big_pipe\Render\Placeholder\BigPipeStrategy;
|
||||
use Drupal\big_pipe\Tests\BigPipePlaceholderTestCases;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\Core\Session\SessionConfigurationInterface;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
@ -22,8 +23,9 @@ class BigPipeStrategyTest extends UnitTestCase {
|
|||
*
|
||||
* @dataProvider placeholdersProvider
|
||||
*/
|
||||
public function testProcessPlaceholders(array $placeholders, $route_match_has_no_big_pipe_option, $request_has_session, $request_has_big_pipe_nojs_cookie, array $expected_big_pipe_placeholders) {
|
||||
public function testProcessPlaceholders(array $placeholders, $method, $route_match_has_no_big_pipe_option, $request_has_session, $request_has_big_pipe_nojs_cookie, array $expected_big_pipe_placeholders) {
|
||||
$request = new Request();
|
||||
$request->setMethod($method);
|
||||
if ($request_has_big_pipe_nojs_cookie) {
|
||||
$request->cookies->set(BigPipeStrategy::NOJS_COOKIE, 1);
|
||||
}
|
||||
|
@ -45,7 +47,7 @@ class BigPipeStrategyTest extends UnitTestCase {
|
|||
$big_pipe_strategy = new BigPipeStrategy($session_configuration->reveal(), $request_stack->reveal(), $route_match->reveal());
|
||||
$processed_placeholders = $big_pipe_strategy->processPlaceholders($placeholders);
|
||||
|
||||
if (!$route_match_has_no_big_pipe_option && $request_has_session) {
|
||||
if ($request->isMethodSafe() && !$route_match_has_no_big_pipe_option && $request_has_session) {
|
||||
$this->assertSameSize($expected_big_pipe_placeholders, $processed_placeholders, 'BigPipe is able to deliver all placeholders.');
|
||||
foreach (array_keys($placeholders) as $placeholder) {
|
||||
$this->assertSame($expected_big_pipe_placeholders[$placeholder], $processed_placeholders[$placeholder], "Verifying how BigPipeStrategy handles the placeholder '$placeholder'");
|
||||
|
@ -60,7 +62,7 @@ class BigPipeStrategyTest extends UnitTestCase {
|
|||
* @see \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases
|
||||
*/
|
||||
public function placeholdersProvider() {
|
||||
$cases = \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases::cases();
|
||||
$cases = BigPipePlaceholderTestCases::cases();
|
||||
|
||||
// Generate $placeholders variable as expected by
|
||||
// \Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface::processPlaceholders().
|
||||
|
@ -75,13 +77,13 @@ class BigPipeStrategyTest extends UnitTestCase {
|
|||
];
|
||||
|
||||
return [
|
||||
'_no_big_pipe absent, no session, no-JS cookie absent' => [$placeholders, FALSE, FALSE, FALSE, []],
|
||||
'_no_big_pipe absent, no session, no-JS cookie present' => [$placeholders, FALSE, FALSE, TRUE, []],
|
||||
'_no_big_pipe present, no session, no-JS cookie absent' => [$placeholders, TRUE, FALSE, FALSE, []],
|
||||
'_no_big_pipe present, no session, no-JS cookie present' => [$placeholders, TRUE, FALSE, TRUE, []],
|
||||
'_no_big_pipe present, session, no-JS cookie absent' => [$placeholders, TRUE, TRUE, FALSE, []],
|
||||
'_no_big_pipe present, session, no-JS cookie present' => [$placeholders, TRUE, TRUE, TRUE, []],
|
||||
'_no_big_pipe absent, session, no-JS cookie absent: (JS-powered) BigPipe placeholder used for HTML placeholders' => [$placeholders, FALSE, TRUE, FALSE, [
|
||||
'_no_big_pipe absent, no session, no-JS cookie absent' => [$placeholders, 'GET', FALSE, FALSE, FALSE, []],
|
||||
'_no_big_pipe absent, no session, no-JS cookie present' => [$placeholders, 'GET', FALSE, FALSE, TRUE, []],
|
||||
'_no_big_pipe present, no session, no-JS cookie absent' => [$placeholders, 'GET', TRUE, FALSE, FALSE, []],
|
||||
'_no_big_pipe present, no session, no-JS cookie present' => [$placeholders, 'GET', TRUE, FALSE, TRUE, []],
|
||||
'_no_big_pipe present, session, no-JS cookie absent' => [$placeholders, 'GET', TRUE, TRUE, FALSE, []],
|
||||
'_no_big_pipe present, session, no-JS cookie present' => [$placeholders, 'GET', TRUE, TRUE, TRUE, []],
|
||||
'_no_big_pipe absent, session, no-JS cookie absent: (JS-powered) BigPipe placeholder used for HTML placeholders' => [$placeholders, 'GET', FALSE, TRUE, FALSE, [
|
||||
$cases['html']->placeholder => $cases['html']->bigPipePlaceholderRenderArray,
|
||||
$cases['html_attribute_value']->placeholder => $cases['html_attribute_value']->bigPipeNoJsPlaceholderRenderArray,
|
||||
$cases['html_attribute_value_subset']->placeholder => $cases['html_attribute_value_subset']->bigPipeNoJsPlaceholderRenderArray,
|
||||
|
@ -90,7 +92,8 @@ class BigPipeStrategyTest extends UnitTestCase {
|
|||
$cases['exception__lazy_builder']->placeholder => $cases['exception__lazy_builder']->bigPipePlaceholderRenderArray,
|
||||
$cases['exception__embedded_response']->placeholder => $cases['exception__embedded_response']->bigPipePlaceholderRenderArray,
|
||||
]],
|
||||
'_no_big_pipe absent, session, no-JS cookie present: no-JS BigPipe placeholder used for HTML placeholders' => [$placeholders, FALSE, TRUE, TRUE, [
|
||||
'_no_big_pipe absent, session, no-JS cookie absent: (JS-powered) BigPipe placeholder used for HTML placeholders — but unsafe method' => [$placeholders, 'POST', FALSE, TRUE, FALSE, []],
|
||||
'_no_big_pipe absent, session, no-JS cookie present: no-JS BigPipe placeholder used for HTML placeholders' => [$placeholders, 'GET', FALSE, TRUE, TRUE, [
|
||||
$cases['html']->placeholder => $cases['html']->bigPipeNoJsPlaceholderRenderArray,
|
||||
$cases['html_attribute_value']->placeholder => $cases['html_attribute_value']->bigPipeNoJsPlaceholderRenderArray,
|
||||
$cases['html_attribute_value_subset']->placeholder => $cases['html_attribute_value_subset']->bigPipeNoJsPlaceholderRenderArray,
|
||||
|
@ -99,6 +102,7 @@ class BigPipeStrategyTest extends UnitTestCase {
|
|||
$cases['exception__lazy_builder']->placeholder => $cases['exception__lazy_builder']->bigPipeNoJsPlaceholderRenderArray,
|
||||
$cases['exception__embedded_response']->placeholder => $cases['exception__embedded_response']->bigPipeNoJsPlaceholderRenderArray,
|
||||
]],
|
||||
'_no_big_pipe absent, session, no-JS cookie present: no-JS BigPipe placeholder used for HTML placeholders — but unsafe method' => [$placeholders, 'POST', FALSE, TRUE, TRUE, []],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class Block extends DrupalSqlBase {
|
|||
*/
|
||||
protected function initializeIterator() {
|
||||
$this->defaultTheme = $this->variableGet('theme_default', 'Garland');
|
||||
$this->adminTheme = $this->variableGet('admin_theme', null);
|
||||
$this->adminTheme = $this->variableGet('admin_theme', NULL);
|
||||
return parent::initializeIterator();
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,8 @@ class BlockLanguageTest extends WebTestBase {
|
|||
$this->drupalGet('node', ['query' => ['language' => 'fr']]);
|
||||
$this->assertText('Powered by Drupal', 'The body of the block appears on the page.');
|
||||
|
||||
// Re-login in order to clear the interface language stored in the session.
|
||||
// Log in again in order to clear the interface language stored in the
|
||||
// session.
|
||||
$this->drupalLogout();
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class BlockContextMappingUpdateTest extends UpdatePathTestBase {
|
|||
// Disable maintenance mode.
|
||||
\Drupal::state()->set('system.maintenance_mode', FALSE);
|
||||
|
||||
// We finished updating so we can login the user now.
|
||||
// We finished updating so we can log in the user now.
|
||||
$this->drupalLogin($this->rootUser);
|
||||
|
||||
// The block that we are testing has the following visibility rules:
|
||||
|
|
|
@ -76,4 +76,3 @@ class TestAccessBlock extends BlockBase implements ContainerFactoryPluginInterfa
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ function block_content_add_body_field($block_type_id, $label = 'Body') {
|
|||
$field = FieldConfig::loadByName('block_content', $block_type_id, 'body');
|
||||
if (empty($field)) {
|
||||
$field = FieldConfig::create([
|
||||
'field_storage' => FieldStorageConfig::loadByName('block_content', 'body'),
|
||||
'field_storage' => FieldStorageConfig::loadByName('block_content', 'body'),
|
||||
'bundle' => $block_type_id,
|
||||
'label' => $label,
|
||||
'settings' => array('display_summary' => FALSE),
|
||||
|
|
|
@ -74,7 +74,7 @@ abstract class BlockContentTestBase extends WebTestBase {
|
|||
* Created custom block.
|
||||
*/
|
||||
protected function createBlockContent($title = FALSE, $bundle = 'basic', $save = TRUE) {
|
||||
$title = ($title ? : $this->randomMachineName());
|
||||
$title = $title ?: $this->randomMachineName();
|
||||
$block_content = BlockContent::create(array(
|
||||
'info' => $title,
|
||||
'type' => $bundle,
|
||||
|
|
|
@ -91,8 +91,8 @@ class BlockContentTranslationUITest extends ContentTranslationUITestBase {
|
|||
* Created custom block.
|
||||
*/
|
||||
protected function createBlockContent($title = FALSE, $bundle = FALSE) {
|
||||
$title = ($title ? : $this->randomMachineName());
|
||||
$bundle = ($bundle ? : $this->bundle);
|
||||
$title = $title ?: $this->randomMachineName();
|
||||
$bundle = $bundle ?: $this->bundle;
|
||||
$block_content = BlockContent::create(array(
|
||||
'info' => $title,
|
||||
'type' => $bundle,
|
||||
|
|
|
@ -46,7 +46,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
|
|||
* Tests creating a block type programmatically and via a form.
|
||||
*/
|
||||
public function testBlockContentTypeCreation() {
|
||||
// Login a test user.
|
||||
// Log in a test user.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
// Test the page with no block-types.
|
||||
|
|
|
@ -135,11 +135,11 @@ interface BookManagerInterface {
|
|||
/**
|
||||
* Provides book loading, access control and translation.
|
||||
*
|
||||
* @param array $link
|
||||
* A book link.
|
||||
*
|
||||
* Note: copied from _menu_link_translate() in menu.inc, but reduced to the
|
||||
* minimal code that's used.
|
||||
*
|
||||
* @param array $link
|
||||
* A book link.
|
||||
*/
|
||||
public function bookLinkTranslate(&$link);
|
||||
|
||||
|
|
|
@ -81,4 +81,3 @@ class BookSettingsForm extends ConfigFormBase {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ class BookTest extends WebTestBase {
|
|||
// Create a book.
|
||||
$nodes = $this->createBook();
|
||||
|
||||
// Login as web user and view printer-friendly version.
|
||||
// Log in as web user and view printer-friendly version.
|
||||
$this->drupalLogin($this->webUser);
|
||||
$this->drupalGet('node/' . $this->book->id());
|
||||
$this->clickLink(t('Printer-friendly version'));
|
||||
|
@ -735,7 +735,7 @@ class BookTest extends WebTestBase {
|
|||
$node_storage = \Drupal::entityManager()->getStorage('node');
|
||||
$node_storage->resetCache();
|
||||
|
||||
// Login as user without access to the book node, so no 'node test view'
|
||||
// Log in as user without access to the book node, so no 'node test view'
|
||||
// permission.
|
||||
// @see node_access_test_node_grants().
|
||||
$this->drupalLogin($this->webUserWithoutNodeAccess);
|
||||
|
|
|
@ -195,7 +195,7 @@ class BreakpointManager extends DefaultPluginManager implements BreakpointManage
|
|||
// Get the labels. This is not cacheable due to translation.
|
||||
$group_labels = array();
|
||||
foreach ($groups as $group) {
|
||||
$group_labels[$group] = $this->getGroupLabel($group);
|
||||
$group_labels[$group] = $this->getGroupLabel($group);
|
||||
}
|
||||
asort($group_labels);
|
||||
return $group_labels;
|
||||
|
|
|
@ -107,7 +107,7 @@ function template_preprocess_ckeditor_settings_toolbar(&$variables) {
|
|||
|
||||
// Set additional flag on the button if it can occur multiple times.
|
||||
if (!empty($button['multiple'])) {
|
||||
$button_item['multiple'] = true;
|
||||
$button_item['multiple'] = TRUE;
|
||||
}
|
||||
|
||||
return $button_item;
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
|
|||
|
||||
use Drupal\ckeditor\CKEditorPluginBase;
|
||||
use Drupal\ckeditor\CKEditorPluginContextualInterface;
|
||||
use Drupal\Component\Utility\NestedArray;
|
||||
use Drupal\ckeditor\CKEditorPluginManager;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Cache\CacheBackendInterface;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
|
@ -113,14 +113,7 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter
|
|||
list($config['allowedContent'], $config['disallowedContent']) = $this->generateACFSettings($editor);
|
||||
|
||||
// Add the format_tags setting, if its button is enabled.
|
||||
$toolbar_rows = array();
|
||||
$settings = $editor->getSettings();
|
||||
foreach ($settings['toolbar']['rows'] as $row_number => $row) {
|
||||
$toolbar_rows[] = array_reduce($settings['toolbar']['rows'][$row_number], function (&$result, $button_group) {
|
||||
return array_merge($result, $button_group['items']);
|
||||
}, array());
|
||||
}
|
||||
$toolbar_buttons = array_unique(NestedArray::mergeDeepArray($toolbar_rows));
|
||||
$toolbar_buttons = CKEditorPluginManager::getEnabledButtons($editor);
|
||||
if (in_array('Format', $toolbar_buttons)) {
|
||||
$config['format_tags'] = $this->generateFormatTagsSetting($editor);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class CKEditorPluginManagerTest extends UnitTestCase {
|
|||
* @dataProvider providerGetEnabledButtons
|
||||
*/
|
||||
public function testGetEnabledButtons(array $toolbar_rows, array $expected_buttons) {
|
||||
$editor= $this->prophesize(Editor::class);
|
||||
$editor = $this->prophesize(Editor::class);
|
||||
$editor->getSettings()
|
||||
->willReturn(['toolbar' => ['rows' => $toolbar_rows]]);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ function color_form_system_theme_settings_alter(&$form, FormStateInterface $form
|
|||
* Replaces style sheets declared in libraries with color-altered style sheets.
|
||||
*/
|
||||
function color_library_info_alter(&$libraries, $extension) {
|
||||
$themes = array_keys(\Drupal::service('theme_handler')->listInfo());
|
||||
$themes = array_keys(\Drupal::service('theme_handler')->listInfo());
|
||||
if (in_array($extension, $themes)) {
|
||||
$color_paths = \Drupal::config('color.theme.' . $extension)->get('stylesheets');
|
||||
if (!empty($color_paths)) {
|
||||
|
@ -780,7 +780,7 @@ function _color_hsl2rgb($hsl) {
|
|||
$h = $hsl[0];
|
||||
$s = $hsl[1];
|
||||
$l = $hsl[2];
|
||||
$m2 = ($l <= 0.5) ? $l * ($s + 1) : $l + $s - $l*$s;
|
||||
$m2 = ($l <= 0.5) ? $l * ($s + 1) : $l + $s - $l * $s;
|
||||
$m1 = $l * 2 - $m2;
|
||||
|
||||
return array(
|
||||
|
|
|
@ -162,7 +162,7 @@ class CommentForm extends ContentEntityForm {
|
|||
'#maxlength' => 60,
|
||||
'#access' => $this->currentUser->isAnonymous() || $is_admin,
|
||||
'#size' => 30,
|
||||
'#attributes'=> [
|
||||
'#attributes' => [
|
||||
'data-drupal-default-value' => $config->get('anonymous'),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -15,7 +15,7 @@ use Drupal\Core\Url;
|
|||
/**
|
||||
* Defines a class for building markup for comment links on a commented entity.
|
||||
*
|
||||
* Comment links include 'login to post new comment', 'add new comment' etc.
|
||||
* Comment links include 'log in to post new comment', 'add new comment' etc.
|
||||
*/
|
||||
class CommentLinkBuilder implements CommentLinkBuilderInterface {
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use Drupal\Core\Entity\FieldableEntityInterface;
|
|||
/**
|
||||
* Defines an interface for building comment links on a commented entity.
|
||||
*
|
||||
* Comment links include 'login to post new comment', 'add new comment' etc.
|
||||
* Comment links include 'log in to post new comment', 'add new comment' etc.
|
||||
*/
|
||||
interface CommentLinkBuilderInterface {
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class CommentStatistics implements CommentStatisticsInterface {
|
|||
*/
|
||||
public function read($entities, $entity_type, $accurate = TRUE) {
|
||||
$options = $accurate ? array() : array('target' => 'replica');
|
||||
$stats = $this->database->select('comment_entity_statistics', 'ces', $options)
|
||||
$stats = $this->database->select('comment_entity_statistics', 'ces', $options)
|
||||
->fields('ces')
|
||||
->condition('ces.entity_id', array_keys($entities), 'IN')
|
||||
->condition('ces.entity_type', $entity_type)
|
||||
|
|
|
@ -164,7 +164,7 @@ class CommentTypeForm extends EntityForm {
|
|||
else {
|
||||
$this->commentManager->addBodyField($comment_type->id());
|
||||
drupal_set_message(t('Comment type %label has been added.', array('%label' => $comment_type->label())));
|
||||
$this->logger->notice('Comment type %label has been added.', array('%label' => $comment_type->label(), 'link' => $edit_link));
|
||||
$this->logger->notice('Comment type %label has been added.', array('%label' => $comment_type->label(), 'link' => $edit_link));
|
||||
}
|
||||
|
||||
$form_state->setRedirectUrl($comment_type->urlInfo('collection'));
|
||||
|
|
|
@ -20,7 +20,7 @@ use Drupal\user\UserInterface;
|
|||
* @ContentEntityType(
|
||||
* id = "comment",
|
||||
* label = @Translation("Comment"),
|
||||
* bundle_label = @Translation("Content type"),
|
||||
* bundle_label = @Translation("Comment type"),
|
||||
* handlers = {
|
||||
* "storage" = "Drupal\comment\CommentStorage",
|
||||
* "storage_schema" = "Drupal\comment\CommentStorageSchema",
|
||||
|
|
|
@ -174,7 +174,7 @@ class CommentDefaultFormatter extends FormatterBase implements ContainerFactoryP
|
|||
// that page, we need to pass that subrequest route to our pager to
|
||||
// keep the pager working.
|
||||
$build['pager']['#route_name'] = $this->routeMatch->getRouteObject();
|
||||
$build['pager']['#route_parameters'] = $this->routeMatch->getRawParameters()->all();
|
||||
$build['pager']['#route_parameters'] = $this->routeMatch->getRawParameters()->all();
|
||||
if ($this->getSetting('pager_id')) {
|
||||
$build['pager']['#element'] = $this->getSetting('pager_id');
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class Depth extends Field {
|
|||
foreach ($items as &$item) {
|
||||
// Work out the depth of this comment.
|
||||
$comment_thread = $item['rendered']['#markup'];
|
||||
$item['rendered']['#markup'] = count(explode('.', $comment_thread)) - 1;
|
||||
$item['rendered']['#markup'] = count(explode('.', $comment_thread)) - 1;
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ class CommentAdminTest extends CommentTestBase {
|
|||
'skip comment approval',
|
||||
));
|
||||
|
||||
// Login as a web user.
|
||||
// Log in as a web user.
|
||||
$this->drupalLogin($this->webUser);
|
||||
// Post a comment.
|
||||
$comment = $this->postComment($this->node, $this->randomMachineName());
|
||||
|
@ -201,7 +201,7 @@ class CommentAdminTest extends CommentTestBase {
|
|||
$author_mail = $this->randomMachineName() . '@example.com';
|
||||
$anonymous_comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), array('name' => $author_name, 'mail' => $author_mail));
|
||||
|
||||
// Login as an admin user.
|
||||
// Log in as an admin user.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
// Make sure the comment field is not visible when
|
||||
|
|
|
@ -173,7 +173,7 @@ class CommentAnonymousTest extends CommentTestBase {
|
|||
));
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
$this->assertPattern('@<h2[^>]*>Comments</h2>@', 'Comments were displayed.');
|
||||
$this->assertLink('Log in', 1, 'Link to log in was found.');
|
||||
$this->assertLink('Log in', 1, 'Link to login was found.');
|
||||
$this->assertLink('register', 1, 'Link to register was found.');
|
||||
|
||||
user_role_change_permissions(RoleInterface::ANONYMOUS_ID, array(
|
||||
|
|
|
@ -82,7 +82,7 @@ class CommentCacheTagsTest extends EntityWithUriCacheTagsTestBase {
|
|||
'entity_id' => $this->entityTestCamelid->id(),
|
||||
'entity_type' => 'entity_test',
|
||||
'field_name' => 'comment',
|
||||
'status' => \Drupal\comment\CommentInterface::PUBLISHED,
|
||||
'status' => CommentInterface::PUBLISHED,
|
||||
));
|
||||
$comment->save();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class CommentLanguageTest extends WebTestBase {
|
|||
|
||||
$this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
|
||||
|
||||
// Create and login user.
|
||||
// Create and log in user.
|
||||
$admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer languages', 'access administration pages', 'administer content types', 'administer comments', 'create article content', 'access comments', 'post comments', 'skip comment approval'));
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
|
|
|
@ -356,7 +356,7 @@ class CommentNonNodeTest extends WebTestBase {
|
|||
));
|
||||
$this->drupalGet('entity_test/' . $this->entity->id());
|
||||
$this->assertPattern('@<h2[^>]*>Comments</h2>@', 'Comments were displayed.');
|
||||
$this->assertLink('Log in', 0, 'Link to log in was found.');
|
||||
$this->assertLink('Log in', 0, 'Link to login was found.');
|
||||
$this->assertLink('register', 0, 'Link to register was found.');
|
||||
$this->assertNoFieldByName('subject[0][value]', '', 'Subject field not found.');
|
||||
$this->assertNoFieldByName('comment_body[0][value]', '', 'Comment field not found.');
|
||||
|
|
|
@ -35,7 +35,7 @@ class CommentPreviewTest extends CommentTestBase {
|
|||
$this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_THREADED, 'Comment paging changed.');
|
||||
$this->drupalLogout();
|
||||
|
||||
// Login as web user.
|
||||
// Log in as web user.
|
||||
$this->drupalLogin($this->webUser);
|
||||
|
||||
// Test escaping of the username on the preview form.
|
||||
|
@ -86,7 +86,7 @@ class CommentPreviewTest extends CommentTestBase {
|
|||
$this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_THREADED, 'Comment paging changed.');
|
||||
$this->drupalLogout();
|
||||
|
||||
// Login as web user.
|
||||
// Log in as web user.
|
||||
$this->drupalLogin($this->webUser);
|
||||
|
||||
// As the web user, fill in the comment form and preview the comment.
|
||||
|
|
|
@ -54,7 +54,7 @@ class CommentTypeTest extends CommentTestBase {
|
|||
$comment_type = CommentType::load('other');
|
||||
$this->assertTrue($comment_type, 'The new comment type has been created.');
|
||||
|
||||
// Login a test user.
|
||||
// Log in a test user.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
$this->drupalGet('admin/structure/comment/manage/' . $type->id());
|
||||
|
|
|
@ -19,7 +19,7 @@ function config_help($route_name, RouteMatchInterface $route_match) {
|
|||
$output .= '<h3>' . t('Uses') . '</h3>';
|
||||
$output .= '<dl>';
|
||||
$output .= '<dt>' . t('Exporting the full configuration') . '</dt>';
|
||||
$output .= '<dd>' . t('You can create and download an archive consisting of all your site\'s configuration exported as <em>*.yml</em> files on the <a href=":url">Export</a> page.' , array(':url' => \Drupal::url('config.export_full'))) . '</dd>';
|
||||
$output .= '<dd>' . t('You can create and download an archive consisting of all your site\'s configuration exported as <em>*.yml</em> files on the <a href=":url">Export</a> page.', array(':url' => \Drupal::url('config.export_full'))) . '</dd>';
|
||||
$output .= '<dt>' . t('Importing a full configuration') . '</dt>';
|
||||
$output .= '<dd>' . t('You can upload a full site configuration from an archive file on the <a href=":url">Import</a> page. When importing data from a different environment, the site and import files must have matching configuration values for UUID in the <em>system.site</em> configuration item. That means that your other environments should initially be set up as clones of the target site. Migrations are not supported.', array(':url' => \Drupal::url('config.import_full'))) . '</dd>';
|
||||
$output .= '<dt>' . t('Synchronizing configuration'). '</dt>';
|
||||
|
|
|
@ -100,4 +100,3 @@ class ConfigImportForm extends FormBase {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
* Provides hook implementations for testing purposes.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_create.
|
||||
*/
|
||||
function config_install_dependency_test_config_test_create(\Drupal\Core\Entity\EntityInterface $entity) {
|
||||
function config_install_dependency_test_config_test_create(EntityInterface $entity) {
|
||||
// Add an enforced dependency on this module so that we can test if this is
|
||||
// possible during module installation.
|
||||
$entity->setEnforcedDependencies(['module' => ['config_install_dependency_test']]);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
* config_test entity hooks themselves.
|
||||
*/
|
||||
|
||||
use Drupal\config_test\Entity\ConfigTest;
|
||||
|
||||
/**
|
||||
* Implements hook_config_test_load().
|
||||
*/
|
||||
|
@ -16,37 +18,69 @@ function config_test_config_test_load() {
|
|||
$GLOBALS['hook_config_test']['load'] = __FUNCTION__;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_create() for 'config_test'.
|
||||
*/
|
||||
function config_test_config_test_create(ConfigTest $config_test) {
|
||||
if (\Drupal::state()->get('config_test.prepopulate')) {
|
||||
$config_test->set('foo', 'baz');
|
||||
}
|
||||
_config_test_update_is_syncing_store('create', $config_test);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_config_test_presave().
|
||||
*/
|
||||
function config_test_config_test_presave() {
|
||||
function config_test_config_test_presave(ConfigTest $config_test) {
|
||||
$GLOBALS['hook_config_test']['presave'] = __FUNCTION__;
|
||||
_config_test_update_is_syncing_store('presave', $config_test);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_config_test_insert().
|
||||
*/
|
||||
function config_test_config_test_insert() {
|
||||
function config_test_config_test_insert(ConfigTest $config_test) {
|
||||
$GLOBALS['hook_config_test']['insert'] = __FUNCTION__;
|
||||
_config_test_update_is_syncing_store('insert', $config_test);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_config_test_update().
|
||||
*/
|
||||
function config_test_config_test_update() {
|
||||
function config_test_config_test_update(ConfigTest $config_test) {
|
||||
$GLOBALS['hook_config_test']['update'] = __FUNCTION__;
|
||||
_config_test_update_is_syncing_store('update', $config_test);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_config_test_predelete().
|
||||
*/
|
||||
function config_test_config_test_predelete() {
|
||||
function config_test_config_test_predelete(ConfigTest $config_test) {
|
||||
$GLOBALS['hook_config_test']['predelete'] = __FUNCTION__;
|
||||
_config_test_update_is_syncing_store('predelete', $config_test);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_config_test_delete().
|
||||
*/
|
||||
function config_test_config_test_delete() {
|
||||
function config_test_config_test_delete(ConfigTest $config_test) {
|
||||
$GLOBALS['hook_config_test']['delete'] = __FUNCTION__;
|
||||
_config_test_update_is_syncing_store('delete', $config_test);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for testing hooks during configuration sync.
|
||||
*
|
||||
* @param string $hook
|
||||
* The fired hook.
|
||||
* @param \Drupal\config_test\Entity\ConfigTest $config_test
|
||||
* The ConfigTest entity.
|
||||
*/
|
||||
function _config_test_update_is_syncing_store($hook, ConfigTest $config_test) {
|
||||
$current_value = \Drupal::state()->get('config_test.store_isSyncing', FALSE);
|
||||
if ($current_value !== FALSE) {
|
||||
$current_value['global_state::' . $hook] = \Drupal::isConfigSyncing();
|
||||
$current_value['entity_state::' . $hook] = $config_test->isSyncing();
|
||||
\Drupal::state()->set('config_test.store_isSyncing', $current_value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* Provides Config module hook implementations for testing purposes.
|
||||
*/
|
||||
|
||||
use Drupal\config_test\Entity\ConfigTest;
|
||||
|
||||
require_once dirname(__FILE__) . '/config_test.hooks.inc';
|
||||
|
||||
/**
|
||||
|
@ -17,15 +15,6 @@ function config_test_cache_flush() {
|
|||
$GLOBALS['hook_cache_flush'] = __FUNCTION__;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_create() for 'config_test'.
|
||||
*/
|
||||
function config_test_config_test_create(ConfigTest $config_test) {
|
||||
if (\Drupal::state()->get('config_test.prepopulate')) {
|
||||
$config_test->set('foo', 'baz');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_entity_type_alter().
|
||||
*/
|
||||
|
|
|
@ -196,4 +196,3 @@ function config_translation_config_schema_info_alter(&$definitions) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ class ConfigTranslationListUiTest extends WebTestBase {
|
|||
$edit = array(
|
||||
'id' => $menu_name,
|
||||
'description' => '',
|
||||
'label' => $label,
|
||||
'label' => $label,
|
||||
);
|
||||
// Create the menu by posting the form.
|
||||
$this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
|
||||
|
@ -147,7 +147,7 @@ class ConfigTranslationListUiTest extends WebTestBase {
|
|||
// Test if the link to translate the menu is NOT on the page.
|
||||
$this->assertNoLinkByHref($translate_link);
|
||||
|
||||
// Login as Admin again otherwise the rest will fail.
|
||||
// Log in as Admin again otherwise the rest will fail.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
// Test if the link to translate actually goes to the translate page.
|
||||
|
|
|
@ -55,7 +55,7 @@ class ConfigTranslationOverviewTest extends WebTestBase {
|
|||
'access contextual links',
|
||||
'administer views',
|
||||
);
|
||||
// Create and login user.
|
||||
// Create and log in user.
|
||||
$this->drupalLogin($this->drupalCreateUser($permissions));
|
||||
|
||||
// Add languages.
|
||||
|
|
|
@ -104,7 +104,7 @@ class ConfigTranslationUiTest extends WebTestBase {
|
|||
'translate interface',
|
||||
]
|
||||
);
|
||||
// Create and login user.
|
||||
// Create and log in user.
|
||||
$this->translatorUser = $this->drupalCreateUser($translator_permissions);
|
||||
$this->adminUser = $this->drupalCreateUser($admin_permissions);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class ConfigTranslationUiThemeTest extends WebTestBase {
|
|||
'administer site configuration',
|
||||
'translate configuration',
|
||||
];
|
||||
// Create and login user.
|
||||
// Create and log in user.
|
||||
$this->adminUser = $this->drupalCreateUser($admin_permissions);
|
||||
|
||||
// Add languages.
|
||||
|
|
|
@ -32,7 +32,7 @@ class ContactLanguageTest extends WebTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Create and login administrative user.
|
||||
// Create and log in administrative user.
|
||||
$admin_user = $this->drupalCreateUser(array(
|
||||
'access site-wide contact form',
|
||||
'administer languages',
|
||||
|
|
|
@ -42,7 +42,7 @@ class ContactSitewideTest extends WebTestBase {
|
|||
* Tests configuration options and the site-wide contact form.
|
||||
*/
|
||||
function testSiteWideContact() {
|
||||
// Create and login administrative user.
|
||||
// Create and log in administrative user.
|
||||
$admin_user = $this->drupalCreateUser(array(
|
||||
'access site-wide contact form',
|
||||
'administer contact forms',
|
||||
|
@ -296,7 +296,7 @@ class ContactSitewideTest extends WebTestBase {
|
|||
* Tests auto-reply on the site-wide contact form.
|
||||
*/
|
||||
function testAutoReply() {
|
||||
// Create and login administrative user.
|
||||
// Create and log in administrative user.
|
||||
$admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer contact forms', 'administer permissions', 'administer users'));
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class ContactStorageTest extends ContactSitewideTest {
|
|||
* Tests configuration options and the site-wide contact form.
|
||||
*/
|
||||
public function testContactStorage() {
|
||||
// Create and login administrative user.
|
||||
// Create and log in administrative user.
|
||||
$admin_user = $this->drupalCreateUser(array(
|
||||
'access site-wide contact form',
|
||||
'administer contact forms',
|
||||
|
|
|
@ -25,7 +25,7 @@ db_insert('contact')->fields(array(
|
|||
))
|
||||
->values(array(
|
||||
'category' => 'Upgrade test',
|
||||
'recipients'=> 'test1@example.com,test2@example.com',
|
||||
'recipients' => 'test1@example.com,test2@example.com',
|
||||
'reply' => 'Test reply',
|
||||
'weight' => 1,
|
||||
'selected' => 1,
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
*/
|
||||
|
||||
use Drupal\contact\ContactFormInterface;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_entity_base_field_info().
|
||||
*/
|
||||
function contact_storage_test_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
|
||||
function contact_storage_test_entity_base_field_info(EntityTypeInterface $entity_type) {
|
||||
if ($entity_type->id() == 'contact_message') {
|
||||
$fields = array();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class MigrateContactSettingsTest extends MigrateDrupal6TestBase {
|
|||
*/
|
||||
public function testContactSettings() {
|
||||
$config = $this->config('contact.settings');
|
||||
$this->assertIdentical(true, $config->get('user_default_enabled'));
|
||||
$this->assertIdentical(TRUE, $config->get('user_default_enabled'));
|
||||
$this->assertIdentical(3, $config->get('flood.limit'));
|
||||
$this->assertIdentical('some_other_category', $config->get('default_form'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'contact.settings', $config->get());
|
||||
|
|
|
@ -364,7 +364,7 @@ class MailHandlerTest extends UnitTestCase {
|
|||
$message->expects($this->once())
|
||||
->method('copySender')
|
||||
->willReturn($copy_sender);
|
||||
$recipient =$this->getMock('\Drupal\user\UserInterface');
|
||||
$recipient = $this->getMock('\Drupal\user\UserInterface');
|
||||
$recipient->expects($this->once())
|
||||
->method('getEmail')
|
||||
->willReturn('user2@drupal.org');
|
||||
|
|
|
@ -63,7 +63,7 @@ class ContentTranslationRouteSubscriber extends RouteSubscriberBase {
|
|||
'entity_type_id' => $entity_type_id,
|
||||
),
|
||||
array(
|
||||
'_entity_access' => $entity_type_id . '.view',
|
||||
'_entity_access' => $entity_type_id . '.view',
|
||||
'_access_content_translation_overview' => $entity_type_id,
|
||||
),
|
||||
array(
|
||||
|
@ -89,7 +89,7 @@ class ContentTranslationRouteSubscriber extends RouteSubscriberBase {
|
|||
|
||||
),
|
||||
array(
|
||||
'_entity_access' => $entity_type_id . '.view',
|
||||
'_entity_access' => $entity_type_id . '.view',
|
||||
'_access_content_translation_manage' => 'create',
|
||||
),
|
||||
array(
|
||||
|
|
|
@ -163,7 +163,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
|
|||
$language = ConfigurableLanguage::load($langcode);
|
||||
$source_langcode = 'it';
|
||||
$edit = array('source_langcode[source]' => $source_langcode);
|
||||
$entity_type_id = $entity->getEntityTypeId();
|
||||
$entity_type_id = $entity->getEntityTypeId();
|
||||
$add_url = Url::fromRoute("entity.$entity_type_id.content_translation_add", [
|
||||
$entity->getEntityTypeId() => $entity->id(),
|
||||
'source' => $default_langcode,
|
||||
|
|
|
@ -46,7 +46,7 @@ class ContextualUnitTest extends KernelTestBase {
|
|||
$tests[] = array(
|
||||
'links' => array(
|
||||
'foo' => array(
|
||||
'route_parameters'=> array(
|
||||
'route_parameters' => array(
|
||||
'bar',
|
||||
'key' => 'baz',
|
||||
'qux',
|
||||
|
|
|
@ -36,7 +36,7 @@ function datetime_help($route_name, RouteMatchInterface $route_match) {
|
|||
$output .= '<dt>' . t('Managing and displaying date fields') . '</dt>';
|
||||
$output .= '<dd>' . t('The <em>settings</em> and the <em>display</em> of the Date field can be configured separately. See the <a href=":field_ui">Field UI help</a> for more information on how to manage fields and their display.', array(':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#')) . '</dd>';
|
||||
$output .= '<dt>' . t('Displaying dates') . '</dt>';
|
||||
$output .= '<dd>' . t('Dates can be displayed using the <em>Plain</em> or the <em>Default</em> formatter. The <em>Plain</em> formatter displays the date in the <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> format. If you choose the <em>Default</em> formatter, you can choose a format from a predefined list that can be managed on the <a href=":date_format_list">Date and time formats</a> page.', array(':date_format_list'=> \Drupal::url('entity.date_format.collection'))) . '</dd>';
|
||||
$output .= '<dd>' . t('Dates can be displayed using the <em>Plain</em> or the <em>Default</em> formatter. The <em>Plain</em> formatter displays the date in the <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> format. If you choose the <em>Default</em> formatter, you can choose a format from a predefined list that can be managed on the <a href=":date_format_list">Date and time formats</a> page.', array(':date_format_list' => \Drupal::url('entity.date_format.collection'))) . '</dd>';
|
||||
$output .= '</dl>';
|
||||
return $output;
|
||||
}
|
||||
|
|
|
@ -41,13 +41,15 @@ class DateTimeDefaultFormatter extends DateTimeFormatterBase {
|
|||
if ($item->date) {
|
||||
/** @var \Drupal\Core\Datetime\DrupalDateTime $date */
|
||||
$date = $item->date;
|
||||
// Create the ISO date in Universal Time.
|
||||
$iso_date = $date->format("Y-m-d\TH:i:s") . 'Z';
|
||||
|
||||
if ($this->getFieldSetting('datetime_type') == 'date') {
|
||||
// A date without time will pick up the current time, use the default.
|
||||
datetime_date_default_time($date);
|
||||
}
|
||||
|
||||
// Create the ISO date in Universal Time.
|
||||
$iso_date = $date->format("Y-m-d\TH:i:s") . 'Z';
|
||||
|
||||
$this->setTimeZone($date);
|
||||
|
||||
$output = $this->formatDate($date);
|
||||
|
|
|
@ -95,12 +95,12 @@ class DateTimeFieldItemList extends FieldItemList {
|
|||
// A default value should be in the format and timezone used for date
|
||||
// storage.
|
||||
$date = new DrupalDateTime($default_value[0]['default_date'], DATETIME_STORAGE_TIMEZONE);
|
||||
$storage_format = $definition->getSetting('datetime_type') == DateTimeItem::DATETIME_TYPE_DATE ? DATETIME_DATE_STORAGE_FORMAT: DATETIME_DATETIME_STORAGE_FORMAT;
|
||||
$storage_format = $definition->getSetting('datetime_type') == DateTimeItem::DATETIME_TYPE_DATE ? DATETIME_DATE_STORAGE_FORMAT : DATETIME_DATETIME_STORAGE_FORMAT;
|
||||
$value = $date->format($storage_format);
|
||||
// We only provide a default value for the first item, as do all fields.
|
||||
// Otherwise, there is no way to clear out unwanted values on multiple value
|
||||
// fields.
|
||||
$default_value = array(
|
||||
$default_value = array(
|
||||
array(
|
||||
'value' => $value,
|
||||
'date' => $date,
|
||||
|
|
|
@ -106,7 +106,7 @@ class DateTimeItem extends FieldItemBase {
|
|||
|
||||
// Just pick a date in the past year. No guidance is provided by this Field
|
||||
// type.
|
||||
$timestamp = REQUEST_TIME - mt_rand(0, 86400*365);
|
||||
$timestamp = REQUEST_TIME - mt_rand(0, 86400 * 365);
|
||||
if ($type == DateTimeItem::DATETIME_TYPE_DATE) {
|
||||
$values['value'] = gmdate(DATETIME_DATE_STORAGE_FORMAT, $timestamp);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class DateTimeDatelistWidget extends DateTimeWidgetBase {
|
|||
$element['value'] = array(
|
||||
'#type' => 'datelist',
|
||||
'#date_increment' => $increment,
|
||||
'#date_part_order'=> $date_part_order,
|
||||
'#date_part_order' => $date_part_order,
|
||||
) + $element['value'];
|
||||
|
||||
return $element;
|
||||
|
|
|
@ -77,7 +77,7 @@ class DateTimeDefaultWidget extends DateTimeWidgetBase implements ContainerFacto
|
|||
}
|
||||
|
||||
$element['value'] += array(
|
||||
'#date_date_format'=> $date_format,
|
||||
'#date_date_format' => $date_format,
|
||||
'#date_date_element' => $date_type,
|
||||
'#date_date_callbacks' => array(),
|
||||
'#date_time_format' => $time_format,
|
||||
|
|
|
@ -112,7 +112,7 @@ class Date extends NumericDate implements ContainerFactoryPluginInterface {
|
|||
* Override parent method, which deals with dates as integers.
|
||||
*/
|
||||
protected function opSimple($field) {
|
||||
$origin = (!empty($this->value['type']) && $this->value['type'] == 'offset') ? $this->requestStack->getCurrentRequest()->server->get('REQUEST_TIME') : 0;
|
||||
$origin = (!empty($this->value['type']) && $this->value['type'] == 'offset') ? $this->requestStack->getCurrentRequest()->server->get('REQUEST_TIME') : 0;
|
||||
$value = intval(strtotime($this->value['value'], $origin));
|
||||
|
||||
// Convert to ISO. UTC is used since dates are stored in UTC.
|
||||
|
|
|
@ -162,8 +162,9 @@ class DateTimeFieldTest extends WebTestBase {
|
|||
case 'format_type':
|
||||
// Verify that a date is displayed.
|
||||
$expected = format_date($date->getTimestamp(), $new_value);
|
||||
$expected_iso = format_date($date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', 'UTC');
|
||||
$this->renderTestEntity($id);
|
||||
$this->assertText($expected, SafeMarkup::format('Formatted date field using %value format displayed as %expected.', array('%value' => $new_value, '%expected' => $expected)));
|
||||
$this->assertFieldByXPath('//time[@datetime="' . $expected_iso . '"]', $expected, SafeMarkup::format('Formatted date field using %value format displayed as %expected with %expected_iso attribute.', array('%value' => $new_value, '%expected' => $expected, '%expected_iso' => $expected_iso)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -291,8 +292,9 @@ class DateTimeFieldTest extends WebTestBase {
|
|||
case 'format_type':
|
||||
// Verify that a date is displayed.
|
||||
$expected = format_date($date->getTimestamp(), $new_value);
|
||||
$expected_iso = format_date($date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', 'UTC');
|
||||
$this->renderTestEntity($id);
|
||||
$this->assertText($expected, SafeMarkup::format('Formatted date field using %value format displayed as %expected.', array('%value' => $new_value, '%expected' => $expected)));
|
||||
$this->assertFieldByXPath('//time[@datetime="' . $expected_iso . '"]', $expected, SafeMarkup::format('Formatted date field using %value format displayed as %expected with %expected_iso attribute.', array('%value' => $new_value, '%expected' => $expected, '%expected_iso' => $expected_iso)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ class DbLogTest extends WebTestBase {
|
|||
* interfaces.
|
||||
*/
|
||||
function testDbLog() {
|
||||
// Login the admin user.
|
||||
// Log in the admin user.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
$row_limit = 100;
|
||||
|
@ -78,7 +78,7 @@ class DbLogTest extends WebTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
// Login the regular user.
|
||||
// Log in the regular user.
|
||||
$this->drupalLogin($this->webUser);
|
||||
$this->verifyReports(403);
|
||||
}
|
||||
|
@ -148,7 +148,9 @@ class DbLogTest extends WebTestBase {
|
|||
private function generateLogEntries($count, $options = array()) {
|
||||
global $base_root;
|
||||
|
||||
// Make it just a little bit harder to pass the link part of the test.
|
||||
// This long URL makes it just a little bit harder to pass the link part of
|
||||
// the test with a mix of English words and a repeating series of random
|
||||
// percent-encoded Chinese characters.
|
||||
$link = urldecode('/content/xo%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A-lake-isabelle');
|
||||
|
||||
// Prepare the fields to be logged
|
||||
|
@ -302,9 +304,9 @@ class DbLogTest extends WebTestBase {
|
|||
$this->assertTrue($user != NULL, format_string('User @name was loaded', array('@name' => $name)));
|
||||
// pass_raw property is needed by drupalLogin.
|
||||
$user->pass_raw = $pass;
|
||||
// Login user.
|
||||
// Log in user.
|
||||
$this->drupalLogin($user);
|
||||
// Logout user.
|
||||
// Log out user.
|
||||
$this->drupalLogout();
|
||||
// Fetch the row IDs in watchdog that relate to the user.
|
||||
$result = db_query('SELECT wid FROM {watchdog} WHERE uid = :uid', array(':uid' => $user->id()));
|
||||
|
@ -314,7 +316,7 @@ class DbLogTest extends WebTestBase {
|
|||
$count_before = (isset($ids)) ? count($ids) : 0;
|
||||
$this->assertTrue($count_before > 0, format_string('DBLog contains @count records for @name', array('@count' => $count_before, '@name' => $user->getUsername())));
|
||||
|
||||
// Login the admin user.
|
||||
// Log in the admin user.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
// Delete the user created at the start of this test.
|
||||
// We need to POST here to invoke batch_process() in the internal browser.
|
||||
|
@ -329,9 +331,9 @@ class DbLogTest extends WebTestBase {
|
|||
// Default display includes name and email address; if too long, the email
|
||||
// address is replaced by three periods.
|
||||
$this->assertLogMessage(t('New user: %name %email.', array('%name' => $name, '%email' => '<' . $user->getEmail() . '>')), 'DBLog event was recorded: [add user]');
|
||||
// Login user.
|
||||
// Log in user.
|
||||
$this->assertLogMessage(t('Session opened for %name.', array('%name' => $name)), 'DBLog event was recorded: [login user]');
|
||||
// Logout user.
|
||||
// Log out user.
|
||||
$this->assertLogMessage(t('Session closed for %name.', array('%name' => $name)), 'DBLog event was recorded: [logout user]');
|
||||
// Delete user.
|
||||
$message = t('Deleted user: %name %email.', array('%name' => $name, '%email' => '<' . $user->getEmail() . '>'));
|
||||
|
@ -374,7 +376,7 @@ class DbLogTest extends WebTestBase {
|
|||
// Create user.
|
||||
$perm = array('create ' . $type . ' content', 'edit own ' . $type . ' content', 'delete own ' . $type . ' content');
|
||||
$user = $this->drupalCreateUser($perm);
|
||||
// Login user.
|
||||
// Log in user.
|
||||
$this->drupalLogin($user);
|
||||
|
||||
// Create a node using the form in order to generate an add content event
|
||||
|
@ -400,7 +402,7 @@ class DbLogTest extends WebTestBase {
|
|||
$this->drupalGet('admin/reports/dblog');
|
||||
$this->assertResponse(403);
|
||||
|
||||
// Login the admin user.
|
||||
// Log in the admin user.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
// View the database log report.
|
||||
$this->drupalGet('admin/reports/dblog');
|
||||
|
@ -499,7 +501,7 @@ class DbLogTest extends WebTestBase {
|
|||
$this->container->get('logger.dblog')->log($log['severity'], $log['message'], $log);
|
||||
// Make sure the table count has actually been incremented.
|
||||
$this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), format_string('\Drupal\dblog\Logger\DbLog->log() added an entry to the dblog :count', array(':count' => $count)));
|
||||
// Login the admin user.
|
||||
// Log in the admin user.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
// Post in order to clear the database table.
|
||||
$this->drupalPostForm('admin/reports/dblog', array(), t('Clear log messages'));
|
||||
|
|
|
@ -103,7 +103,7 @@ class EditorAdminTest extends WebTestBase {
|
|||
* Tests format disabling.
|
||||
*/
|
||||
public function testDisableFormatWithEditor() {
|
||||
$formats = ['monocerus' => 'Monocerus', 'tattoo' => 'Tattoo'];
|
||||
$formats = ['monocerus' => 'Monocerus', 'tattoo' => 'Tattoo'];
|
||||
|
||||
// Install the node module.
|
||||
$this->container->get('module_installer')->install(['node']);
|
||||
|
@ -130,7 +130,7 @@ class EditorAdminTest extends WebTestBase {
|
|||
$node->body->format = 'monocerus';
|
||||
$node->save();
|
||||
|
||||
// Login as an user able to use both formats and edit nodes of created type.
|
||||
// Log in as an user able to use both formats and edit nodes of created type.
|
||||
$account = $this->drupalCreateUser($permissions);
|
||||
$this->drupalLogin($account);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\editor\Tests;
|
||||
namespace Drupal\Tests\editor\Kernel;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\Core\EventSubscriber\AjaxResponseSubscriber;
|
||||
|
@ -8,7 +8,7 @@ use Drupal\Core\Language\LanguageInterface;
|
|||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\entity_test\Entity\EntityTest;
|
||||
use Drupal\quickedit\MetadataGenerator;
|
||||
use Drupal\quickedit\Tests\QuickEditTestBase;
|
||||
use Drupal\Tests\quickedit\Kernel\QuickEditTestBase;
|
||||
use Drupal\quickedit_test\MockEditEntityFieldAccessCheck;
|
||||
use Drupal\editor\EditorController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
|
@ -7,6 +7,7 @@
|
|||
use Drupal\Core\Config\ConfigImporter;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface;
|
||||
use Drupal\field\ConfigImporterFieldPurger;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\field\FieldConfigInterface;
|
||||
|
@ -168,7 +169,7 @@ function field_cron() {
|
|||
/**
|
||||
* Implements hook_entity_field_storage_info().
|
||||
*/
|
||||
function field_entity_field_storage_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
|
||||
function field_entity_field_storage_info(EntityTypeInterface $entity_type) {
|
||||
if (\Drupal::entityManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) {
|
||||
// Query by filtering on the ID as this is more efficient than filtering
|
||||
// on the entity_type property directly.
|
||||
|
@ -213,7 +214,7 @@ function field_entity_bundle_field_info(EntityTypeInterface $entity_type, $bundl
|
|||
function field_entity_bundle_delete($entity_type_id, $bundle) {
|
||||
$storage = \Drupal::entityManager()->getStorage('field_config');
|
||||
// Get the fields on the bundle.
|
||||
$fields = $storage->loadByProperties(['entity_type' => $entity_type_id, 'bundle' => $bundle]);
|
||||
$fields = $storage->loadByProperties(['entity_type' => $entity_type_id, 'bundle' => $bundle]);
|
||||
// This deletes the data for the field as well as the field themselves. This
|
||||
// function actually just marks the data and fields as deleted, leaving the
|
||||
// garbage collection for a separate process, because it is not always
|
||||
|
@ -301,7 +302,7 @@ function _field_create_entity_from_ids($ids) {
|
|||
* Implements hook_config_import_steps_alter().
|
||||
*/
|
||||
function field_config_import_steps_alter(&$sync_steps, ConfigImporter $config_importer) {
|
||||
$field_storages = \Drupal\field\ConfigImporterFieldPurger::getFieldStoragesToPurge(
|
||||
$field_storages = ConfigImporterFieldPurger::getFieldStoragesToPurge(
|
||||
$config_importer->getStorageComparer()->getSourceStorage()->read('core.extension'),
|
||||
$config_importer->getStorageComparer()->getChangelist('delete')
|
||||
);
|
||||
|
@ -327,7 +328,7 @@ function field_form_config_admin_import_form_alter(&$form, FormStateInterface $f
|
|||
$user_input = $form_state->getUserInput();
|
||||
$storage_comparer = $form_state->get('storage_comparer');
|
||||
if ($storage_comparer && empty($user_input)) {
|
||||
$field_storages = \Drupal\field\ConfigImporterFieldPurger::getFieldStoragesToPurge(
|
||||
$field_storages = ConfigImporterFieldPurger::getFieldStoragesToPurge(
|
||||
$storage_comparer->getSourceStorage()->read('core.extension'),
|
||||
$storage_comparer->getChangelist('delete')
|
||||
);
|
||||
|
|
|
@ -222,6 +222,10 @@ class FieldStorageConfig extends ConfigEntityBase implements FieldStorageConfigI
|
|||
/**
|
||||
* Constructs a FieldStorageConfig object.
|
||||
*
|
||||
* In most cases, Field entities are created via
|
||||
* FieldStorageConfig::create($values)), where $values is the same parameter
|
||||
* as in this constructor.
|
||||
*
|
||||
* @param array $values
|
||||
* An array of field properties, keyed by property name. Most array
|
||||
* elements will be used to set the corresponding properties on the class;
|
||||
|
@ -232,10 +236,6 @@ class FieldStorageConfig extends ConfigEntityBase implements FieldStorageConfigI
|
|||
* - entity_type: required.
|
||||
* - type: required.
|
||||
*
|
||||
* In most cases, Field entities are created via
|
||||
* FieldStorageConfig::create($values)), where $values is the same
|
||||
* parameter as in this constructor.
|
||||
*
|
||||
* @see entity_create()
|
||||
*/
|
||||
public function __construct(array $values, $entity_type = 'field_storage_config') {
|
||||
|
|
|
@ -79,7 +79,7 @@ class Field extends DrupalSqlBase {
|
|||
['field_name' => $row->getSourceProperty('field_name')],
|
||||
$this->t('Widget types @types are used in Drupal 6 field instances: widget type @selected_type applied to the Drupal 8 base field', [
|
||||
'@types' => implode(', ', $widget_types),
|
||||
'@selected_type' => $widget_types[0],
|
||||
'@selected_type' => $widget_types[0],
|
||||
])
|
||||
);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class FieldHelpTest extends WebTestBase {
|
|||
* Test the Field module's help page.
|
||||
*/
|
||||
public function testFieldHelp() {
|
||||
// Login the admin user.
|
||||
// Log in the admin user.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
// Visit the Help page and make sure no warnings or notices are thrown.
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\field\Tests\FieldUnitTestBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\field\Tests;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\Component\Serialization\Yaml;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
|
||||
$connection = Database::getConnection();
|
||||
|
||||
|
@ -59,8 +60,8 @@ $installed = $connection->select('key_value')
|
|||
->execute()
|
||||
->fetchField();
|
||||
$installed = unserialize($installed);
|
||||
$installed['field_ref_views_select_2429191'] = new \Drupal\field\Entity\FieldStorageConfig($field_ref_views_select_2429191);
|
||||
$installed['field_ref_autocreate_2412569'] = new \Drupal\field\Entity\FieldStorageConfig($field_ref_autocreate_2412569);
|
||||
$installed['field_ref_views_select_2429191'] = new FieldStorageConfig($field_ref_views_select_2429191);
|
||||
$installed['field_ref_autocreate_2412569'] = new FieldStorageConfig($field_ref_autocreate_2412569);
|
||||
$connection->update('key_value')
|
||||
->condition('collection', 'entity.definitions.installed')
|
||||
->condition('name', 'node.field_storage_definitions')
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
* test helper functions
|
||||
*/
|
||||
|
||||
use Drupal\field\FieldStorageConfigInterface;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\field\FieldStorageConfigInterface;
|
||||
|
||||
require_once __DIR__ . '/field_test.entity.inc';
|
||||
require_once __DIR__ . '/field_test.field.inc';
|
||||
|
@ -149,7 +150,7 @@ function field_test_entity_extra_field_info_alter(&$info) {
|
|||
/**
|
||||
* Implements hook_entity_bundle_field_info_alter().
|
||||
*/
|
||||
function field_test_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) {
|
||||
function field_test_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle) {
|
||||
if (($field_name = \Drupal::state()->get('field_test_set_constraint', FALSE)) && $entity_type->id() == 'entity_test' && $bundle == 'entity_test' && !empty($fields[$field_name])) {
|
||||
$fields[$field_name]->setPropertyConstraints('value', [
|
||||
'Range' => [
|
||||
|
|
|
@ -5,12 +5,15 @@
|
|||
* Test module.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
use Drupal\Core\Field\FormatterInterface;
|
||||
use Drupal\Core\Field\WidgetInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_field_widget_third_party_settings_form().
|
||||
*/
|
||||
function field_third_party_test_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $form_mode, $form, FormStateInterface $form_state) {
|
||||
function field_third_party_test_field_widget_third_party_settings_form(WidgetInterface $plugin, FieldDefinitionInterface $field_definition, $form_mode, $form, FormStateInterface $form_state) {
|
||||
$element['field_test_widget_third_party_settings_form'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('3rd party widget settings form'),
|
||||
|
@ -30,7 +33,7 @@ function field_third_party_test_field_widget_settings_summary_alter(&$summary, $
|
|||
/**
|
||||
* Implements hook_field_formatter_third_party_settings_form().
|
||||
*/
|
||||
function field_third_party_test_field_formatter_third_party_settings_form(\Drupal\Core\Field\FormatterInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $view_mode, $form, FormStateInterface $form_state) {
|
||||
function field_third_party_test_field_formatter_third_party_settings_form(FormatterInterface $plugin, FieldDefinitionInterface $field_definition, $view_mode, $form, FormStateInterface $form_state) {
|
||||
$element['field_test_field_formatter_third_party_settings_form'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('3rd party formatter settings form'),
|
||||
|
@ -46,4 +49,3 @@ function field_third_party_test_field_formatter_settings_summary_alter(&$summary
|
|||
$summary[] = 'field_test_field_formatter_settings_summary_alter';
|
||||
return $summary;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ class DisplayApiTest extends FieldKernelTestBase {
|
|||
->setComponent($this->fieldName, $this->displayOptions['default'])
|
||||
->save();
|
||||
// Create a display for the teaser view mode.
|
||||
EntityViewMode::create(array('id' => 'entity_test.teaser', 'targetEntityType' => 'entity_test'))->save();
|
||||
EntityViewMode::create(array('id' => 'entity_test.teaser', 'targetEntityType' => 'entity_test'))->save();
|
||||
entity_get_display($field['entity_type'], $field['bundle'], 'teaser')
|
||||
->setComponent($this->fieldName, $this->displayOptions['teaser'])
|
||||
->save();
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Drupal\Tests\field\Kernel\EntityReference;
|
|||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Cache\CacheableMetadata;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
|
||||
|
@ -204,6 +205,68 @@ class EntityReferenceFormatterTest extends EntityKernelTestBase {
|
|||
$this->assertEqual($build[1]['#markup'], $this->unsavedReferencedEntity->label(), sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the recursive rendering protection of the entity formatter.
|
||||
*/
|
||||
public function testEntityFormatterRecursiveRendering() {
|
||||
/** @var \Drupal\Core\Render\RendererInterface $renderer */
|
||||
$renderer = $this->container->get('renderer');
|
||||
$formatter = 'entity_reference_entity_view';
|
||||
$view_builder = $this->entityManager->getViewBuilder($this->entityType);
|
||||
|
||||
// Set the default view mode to use the 'entity_reference_entity_view'
|
||||
// formatter.
|
||||
entity_get_display($this->entityType, $this->bundle, 'default')
|
||||
->setComponent($this->fieldName, [
|
||||
'type' => $formatter,
|
||||
])
|
||||
->save();
|
||||
|
||||
$referencing_entity_1 = entity_create($this->entityType, ['name' => $this->randomMachineName()]);
|
||||
$referencing_entity_1->save();
|
||||
|
||||
// Create a self-reference.
|
||||
$referencing_entity_1->{$this->fieldName}->entity = $referencing_entity_1;
|
||||
$referencing_entity_1->save();
|
||||
|
||||
// Check that the recursive rendering stops after it reaches the specified
|
||||
// limit.
|
||||
$build = $view_builder->view($referencing_entity_1, 'default');
|
||||
$output = $renderer->renderRoot($build);
|
||||
|
||||
// The title of entity_test entities is printed twice by default, so we have
|
||||
// to multiply the formatter's recursive rendering protection limit by 2.
|
||||
// Additionally, we have to take into account 2 additional occurrences of
|
||||
// the entity title because we're rendering the full entity, not just the
|
||||
// reference field.
|
||||
$expected_occurrences = EntityReferenceEntityFormatter::RECURSIVE_RENDER_LIMIT * 2 + 2;
|
||||
$actual_occurrences = substr_count($output, $referencing_entity_1->name->value);
|
||||
$this->assertEqual($actual_occurrences, $expected_occurrences);
|
||||
|
||||
// Repeat the process with another entity in order to check that the
|
||||
// 'recursive_render_id' counter is generated properly.
|
||||
$referencing_entity_2 = entity_create($this->entityType, ['name' => $this->randomMachineName()]);
|
||||
$referencing_entity_2->save();
|
||||
$referencing_entity_2->{$this->fieldName}->entity = $referencing_entity_2;
|
||||
$referencing_entity_2->save();
|
||||
|
||||
$build = $view_builder->view($referencing_entity_2, 'default');
|
||||
$output = $renderer->renderRoot($build);
|
||||
|
||||
$actual_occurrences = substr_count($output, $referencing_entity_2->name->value);
|
||||
$this->assertEqual($actual_occurrences, $expected_occurrences);
|
||||
|
||||
// Now render both entities at the same time and check again.
|
||||
$build = $view_builder->viewMultiple([$referencing_entity_1, $referencing_entity_2], 'default');
|
||||
$output = $renderer->renderRoot($build);
|
||||
|
||||
$actual_occurrences = substr_count($output, $referencing_entity_1->name->value);
|
||||
$this->assertEqual($actual_occurrences, $expected_occurrences);
|
||||
|
||||
$actual_occurrences = substr_count($output, $referencing_entity_2->name->value);
|
||||
$this->assertEqual($actual_occurrences, $expected_occurrences);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the label formatter.
|
||||
*/
|
||||
|
|
|
@ -229,7 +229,7 @@ class EntityReferenceItemTest extends FieldKernelTestBase {
|
|||
$this->assertEqual($vocabulary->label(), $new_name);
|
||||
|
||||
// Make sure the computed term reflects updates to the term id.
|
||||
$vocabulary2 = $vocabulary = Vocabulary::create([
|
||||
$vocabulary2 = $vocabulary = Vocabulary::create([
|
||||
'name' => $this->randomMachineName(),
|
||||
'vid' => Unicode::strtolower($this->randomMachineName()),
|
||||
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
|
||||
|
|
|
@ -46,7 +46,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
|
|||
$values[$current_revision] = $current_values;
|
||||
}
|
||||
|
||||
$storage = $this->container->get('entity.manager')->getStorage($entity_type);
|
||||
$storage = $this->container->get('entity.manager')->getStorage($entity_type);
|
||||
$storage->resetCache();
|
||||
$entity = $storage->load($entity_id);
|
||||
// Confirm current revision loads the correct data.
|
||||
|
@ -54,7 +54,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
|
|||
$this->assertEqual(count($entity->{$this->fieldTestData->field_name}), $cardinality, 'Current revision: expected number of values');
|
||||
for ($delta = 0; $delta < $cardinality; $delta++) {
|
||||
// The field value loaded matches the one inserted or updated.
|
||||
$this->assertEqual($entity->{$this->fieldTestData->field_name}[$delta]->value , $values[$current_revision][$delta]['value'], format_string('Current revision: expected value %delta was found.', array('%delta' => $delta)));
|
||||
$this->assertEqual($entity->{$this->fieldTestData->field_name}[$delta]->value, $values[$current_revision][$delta]['value'], format_string('Current revision: expected value %delta was found.', array('%delta' => $delta)));
|
||||
}
|
||||
|
||||
// Confirm each revision loads the correct data.
|
||||
|
@ -363,7 +363,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
|
|||
// Verify no data gets loaded
|
||||
$controller = $this->container->get('entity.manager')->getStorage($entity->getEntityTypeId());
|
||||
$controller->resetCache();
|
||||
$entity= $controller->load($entity->id());
|
||||
$entity = $controller->load($entity->id());
|
||||
|
||||
$this->assertTrue(empty($entity->{$this->fieldTestData->field_name}), 'No data for first field');
|
||||
$this->assertTrue(empty($entity->{$field_name}), 'No data for second field');
|
||||
|
|
|
@ -95,7 +95,7 @@ class FieldCrudTest extends FieldKernelTestBase {
|
|||
$this->assertIdentical($config['description'], '', 'Description defaults to empty string.');
|
||||
|
||||
// Check that default settings are set.
|
||||
$this->assertEqual($config['settings'], $field_type_manager->getDefaultFieldSettings($this->fieldStorageDefinition['type']) , 'Default field settings have been written.');
|
||||
$this->assertEqual($config['settings'], $field_type_manager->getDefaultFieldSettings($this->fieldStorageDefinition['type']), 'Default field settings have been written.');
|
||||
|
||||
// Check that the denormalized 'field_type' was properly written.
|
||||
$this->assertEqual($config['field_type'], $this->fieldStorageDefinition['type']);
|
||||
|
|
|
@ -74,7 +74,7 @@ class FieldDataCountTest extends FieldKernelTestBase {
|
|||
$this->assertIdentical($this->storage->countFieldData($field_storage), 0, 'There are 0 entities with field data.');
|
||||
|
||||
// Create 12 entities to ensure that the purging works as expected.
|
||||
for ($i=0; $i < 12; $i++) {
|
||||
for ($i = 0; $i < 12; $i++) {
|
||||
$entity = EntityTest::create();
|
||||
$entity->field_int[] = mt_rand(1, 99);
|
||||
$entity->field_int[] = mt_rand(1, 99);
|
||||
|
@ -135,7 +135,7 @@ class FieldDataCountTest extends FieldKernelTestBase {
|
|||
|
||||
$this->assertIdentical($this->fieldTestData->field_storage_2->hasData(), TRUE, 'There are entities with field data.');
|
||||
|
||||
$storage = $this->container->get('entity.manager')->getStorage($entity_type);
|
||||
$storage = $this->container->get('entity.manager')->getStorage($entity_type);
|
||||
$entity = $storage->loadRevision($first_revision);
|
||||
$this->assertEqual(count($entity->{$this->fieldTestData->field_name_2}), $cardinality, format_string('Revision %revision_id: expected number of values.', array('%revision_id' => $first_revision)));
|
||||
}
|
||||
|
|
|
@ -49,4 +49,3 @@ class FieldImportChangeTest extends FieldKernelTestBase {
|
|||
$this->assertEqual($field->getLabel(), $new_label, 'field label updated');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,4 +116,3 @@ class FieldImportCreateTest extends FieldKernelTestBase {
|
|||
$this->assertTrue($field, 'Test import field 2b from sync exists');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,4 +109,3 @@ class FieldImportDeleteTest extends FieldKernelTestBase {
|
|||
$this->assertTrue(empty($deleted_storages), 'Fields are deleted');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ class FieldImportDeleteUninstallTest extends FieldKernelTestBase {
|
|||
])->save();
|
||||
|
||||
// Create 12 entities to ensure that the purging works as expected.
|
||||
for ($i=0; $i < 12; $i++) {
|
||||
for ($i = 0; $i < 12; $i++) {
|
||||
$entity = EntityTest::create();
|
||||
$value = '+0123456789';
|
||||
$entity->field_test = $value;
|
||||
|
|
|
@ -109,9 +109,9 @@ class MigrateFieldFormatterSettingsTest extends MigrateDrupal7TestBase {
|
|||
),
|
||||
'settings' =>
|
||||
array (
|
||||
'display_summary' => true,
|
||||
'display_summary' => TRUE,
|
||||
'text_processing' => 1,
|
||||
'user_register_form' => false,
|
||||
'user_register_form' => FALSE,
|
||||
),
|
||||
'display' =>
|
||||
array (
|
||||
|
@ -136,7 +136,7 @@ class MigrateFieldFormatterSettingsTest extends MigrateDrupal7TestBase {
|
|||
'weight' => 0,
|
||||
),
|
||||
),
|
||||
'required' => false,
|
||||
'required' => FALSE,
|
||||
'description' => '',
|
||||
)),
|
||||
))
|
||||
|
|
|
@ -140,7 +140,7 @@ class FieldConfigEntityUnitTest extends UnitTestCase {
|
|||
$this->fieldTypePluginManager->expects($this->any())
|
||||
->method('getDefinition')
|
||||
->with('test_field')
|
||||
->willReturn(['provider' => 'test_module', 'config_dependencies' =>['module' => ['test_module2']], 'class' => '\Drupal\Tests\field\Unit\DependencyFieldItem']);
|
||||
->willReturn(['provider' => 'test_module', 'config_dependencies' => ['module' => ['test_module2']], 'class' => '\Drupal\Tests\field\Unit\DependencyFieldItem']);
|
||||
|
||||
$this->fieldStorage->expects($this->once())
|
||||
->method('getConfigDependencyName')
|
||||
|
@ -201,7 +201,7 @@ class FieldConfigEntityUnitTest extends UnitTestCase {
|
|||
$this->fieldTypePluginManager->expects($this->any())
|
||||
->method('getDefinition')
|
||||
->with('test_field')
|
||||
->willReturn(['provider' => 'test_module', 'config_dependencies' =>['module' => ['test_module2']], 'class' => '\Drupal\Tests\field\Unit\DependencyFieldItem']);
|
||||
->willReturn(['provider' => 'test_module', 'config_dependencies' => ['module' => ['test_module2']], 'class' => '\Drupal\Tests\field\Unit\DependencyFieldItem']);
|
||||
|
||||
$field = new FieldConfig(array(
|
||||
'field_name' => $this->fieldStorage->getName(),
|
||||
|
|
|
@ -94,7 +94,7 @@ class FieldStorageConfigListBuilder extends ConfigEntityListBuilder {
|
|||
public function buildRow(EntityInterface $field_storage) {
|
||||
if ($field_storage->isLocked()) {
|
||||
$row['class'] = array('menu-disabled');
|
||||
$row['data']['id'] = $this->t('@field_name (Locked)', array('@field_name' => $field_storage->getName()));
|
||||
$row['data']['id'] = $this->t('@field_name (Locked)', array('@field_name' => $field_storage->getName()));
|
||||
}
|
||||
else {
|
||||
$row['data']['id'] = $field_storage->getName();
|
||||
|
|
|
@ -95,7 +95,7 @@ class FieldConfigEditForm extends EntityForm {
|
|||
|
||||
// Add handling for default value.
|
||||
if ($element = $items->defaultValuesForm($form, $form_state)) {
|
||||
$element = array_merge($element , array(
|
||||
$element = array_merge($element, array(
|
||||
'#type' => 'details',
|
||||
'#title' => $this->t('Default value'),
|
||||
'#open' => TRUE,
|
||||
|
|
|
@ -78,7 +78,7 @@ class ManageFieldsTest extends WebTestBase {
|
|||
|
||||
// Create random field name with markup to test escaping.
|
||||
$this->fieldLabel = '<em>' . $this->randomMachineName(8) . '</em>';
|
||||
$this->fieldNameInput = strtolower($this->randomMachineName(8));
|
||||
$this->fieldNameInput = strtolower($this->randomMachineName(8));
|
||||
$this->fieldName = 'field_'. $this->fieldNameInput;
|
||||
|
||||
// Create Basic page and Article node types.
|
||||
|
|
|
@ -38,7 +38,7 @@ function field_ui_test_form_entity_view_display_edit_form_alter(&$form, FormStat
|
|||
'parent_wrapper' => array(
|
||||
'parent' => array(
|
||||
'#type' => 'select',
|
||||
'#options' => array('indent' => 'Indent'),
|
||||
'#options' => array('indent' => 'Indent'),
|
||||
'#empty_value' => '',
|
||||
'#default_value' => '',
|
||||
'#attributes' => array('class' => array('field-parent')),
|
||||
|
|
|
@ -202,7 +202,7 @@ class EntityDisplayTest extends KernelTestBase {
|
|||
$display->setComponent($field_name);
|
||||
$field_type_info = \Drupal::service('plugin.manager.field.field_type')->getDefinition($field_storage->getType());
|
||||
$default_formatter = $field_type_info['default_formatter'];
|
||||
$formatter_settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($default_formatter);
|
||||
$formatter_settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($default_formatter);
|
||||
$expected = array(
|
||||
'weight' => -4,
|
||||
'label' => 'above',
|
||||
|
@ -249,7 +249,7 @@ class EntityDisplayTest extends KernelTestBase {
|
|||
));
|
||||
|
||||
// Check that default options are correctly filled in.
|
||||
$formatter_settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings('text_default');
|
||||
$formatter_settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings('text_default');
|
||||
$expected = array(
|
||||
'test_no_display' => NULL,
|
||||
'test_display_configurable' => array(
|
||||
|
@ -337,7 +337,7 @@ class EntityDisplayTest extends KernelTestBase {
|
|||
$field->save();
|
||||
|
||||
// Create default and teaser entity display.
|
||||
EntityViewMode::create(array('id' => 'entity_test.teaser', 'targetEntityType' => 'entity_test'))->save();
|
||||
EntityViewMode::create(array('id' => 'entity_test.teaser', 'targetEntityType' => 'entity_test'))->save();
|
||||
EntityViewDisplay::create(array(
|
||||
'targetEntityType' => 'entity_test',
|
||||
'bundle' => 'entity_test',
|
||||
|
|
|
@ -126,7 +126,7 @@ class EntityFormDisplayTest extends KernelTestBase {
|
|||
));
|
||||
|
||||
// Check that default options are correctly filled in.
|
||||
$formatter_settings = \Drupal::service('plugin.manager.field.widget')->getDefaultSettings('text_textfield');
|
||||
$formatter_settings = \Drupal::service('plugin.manager.field.widget')->getDefaultSettings('text_textfield');
|
||||
$expected = array(
|
||||
'test_no_display' => NULL,
|
||||
'test_display_configurable' => array(
|
||||
|
@ -193,7 +193,7 @@ class EntityFormDisplayTest extends KernelTestBase {
|
|||
$field->save();
|
||||
|
||||
// Create default and compact entity display.
|
||||
EntityFormMode::create(array('id' => 'entity_test.compact', 'targetEntityType' => 'entity_test'))->save();
|
||||
EntityFormMode::create(array('id' => 'entity_test.compact', 'targetEntityType' => 'entity_test'))->save();
|
||||
EntityFormDisplay::create(array(
|
||||
'targetEntityType' => 'entity_test',
|
||||
'bundle' => 'entity_test',
|
||||
|
|
|
@ -30,7 +30,7 @@ function file_help($route_name, RouteMatchInterface $route_match) {
|
|||
case 'help.page.file':
|
||||
$output = '';
|
||||
$output .= '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('The File module allows you to create fields that contain files. See the <a href=":field">Field module help</a> and the <a href=":field_ui">Field UI help</a> pages for general information on fields and how to create and manage them. For more information, see the <a href=":file_documentation">online documentation for the File module</a>.', array(':field' => \Drupal::url('help.page', array('name' => 'field')), ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) :'#', ':file_documentation' => 'https://www.drupal.org/documentation/modules/file')) . '</p>';
|
||||
$output .= '<p>' . t('The File module allows you to create fields that contain files. See the <a href=":field">Field module help</a> and the <a href=":field_ui">Field UI help</a> pages for general information on fields and how to create and manage them. For more information, see the <a href=":file_documentation">online documentation for the File module</a>.', array(':field' => \Drupal::url('help.page', array('name' => 'field')), ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#', ':file_documentation' => 'https://www.drupal.org/documentation/modules/file')) . '</p>';
|
||||
$output .= '<h3>' . t('Uses') . '</h3>';
|
||||
$output .= '<dl>';
|
||||
$output .= '<dt>' . t('Managing and displaying file fields') . '</dt>';
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue