updated core to 8.6.3

This commit is contained in:
2018-11-21 12:49:46 +01:00
parent 8ca34853a3
commit c92c348eee
521 changed files with 12199 additions and 4578 deletions
@@ -184,17 +184,18 @@
}
@media all and (max-width: 766px) {
.toolbar .toolbar-icon-workspace {
.toolbar .toolbar-bar .workspaces-toolbar-tab .toolbar-icon-workspace {
padding-left: 2.75em;
padding-right: 1.3333em;
text-indent: 0;
width: 8em;
width: auto;
max-width: 8em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.toolbar .toolbar-icon-workspace:before {
.toolbar .toolbar-bar .workspaces-toolbar-tab .toolbar-icon-workspace:before {
background-size: 100% auto;
left: 0.6667em;
width: 20px;
@@ -319,7 +319,7 @@ class EntityOperations implements ContainerInjectionInterface {
// be a pending one.
$active_workspace = $this->workspaceManager->getActiveWorkspace();
if (!$active_workspace->isDefaultWorkspace()) {
$form['#entity_builders'][] = [$this, 'entityFormEntityBuild'];
$form['#entity_builders'][] = [get_called_class(), 'entityFormEntityBuild'];
}
/** @var \Drupal\workspaces\WorkspaceAssociationStorageInterface $workspace_association_storage */
@@ -340,7 +340,7 @@ class EntityOperations implements ContainerInjectionInterface {
/**
* Entity builder that marks all supported entities as pending revisions.
*/
public function entityFormEntityBuild($entity_type_id, RevisionableInterface $entity, &$form, FormStateInterface &$form_state) {
public static function entityFormEntityBuild($entity_type_id, RevisionableInterface $entity, &$form, FormStateInterface &$form_state) {
// Set the non-default revision flag so that validation constraints are also
// aware that a pending revision is about to be created.
$entity->isDefaultRevision(FALSE);
@@ -5,7 +5,7 @@ namespace Drupal\workspaces;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\views\Form\ViewsExposedForm;
use Drupal\workspaces\Form\WorkspaceFormInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -17,8 +17,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/
class FormOperations implements ContainerInjectionInterface {
use StringTranslationTrait;
/**
* The workspace manager service.
*
@@ -104,16 +102,16 @@ class FormOperations implements ContainerInjectionInterface {
}
if (isset($element['#validate'])) {
$element['#validate'][] = [$this, 'validateDefaultWorkspace'];
$element['#validate'][] = [get_called_class(), 'validateDefaultWorkspace'];
}
}
/**
* Validation handler which sets a validation error for all unsupported forms.
*/
public function validateDefaultWorkspace(array &$form, FormStateInterface $form_state) {
public static function validateDefaultWorkspace(array &$form, FormStateInterface $form_state) {
if ($form_state->get('workspace_safe') !== TRUE) {
$form_state->setError($form, $this->t('This form can only be submitted in the default workspace.'));
$form_state->setError($form, new TranslatableMarkup('This form can only be submitted in the default workspace.'));
}
}
@@ -3,10 +3,12 @@
namespace Drupal\Tests\workspaces\Kernel;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\Core\Form\FormState;
use Drupal\entity_test\Entity\EntityTestMulRev;
use Drupal\entity_test\Entity\EntityTestMulRevPub;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\KernelTests\KernelTestBase;
use Drupal\system\Form\SiteInformationForm;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
use Drupal\Tests\node\Traits\NodeCreationTrait;
use Drupal\Tests\user\Traits\UserCreationTrait;
@@ -718,4 +720,35 @@ class WorkspaceIntegrationTest extends KernelTestBase {
return $flattened;
}
/**
* Tests that entity forms can be stored in the form cache.
*/
public function testFormCacheForEntityForms() {
$this->initializeWorkspacesModule();
$this->switchToWorkspace('stage');
$form_builder = $this->container->get('form_builder');
$form = $this->entityTypeManager->getFormObject('entity_test_mulrevpub', 'default');
$form->setEntity(EntityTestMulRevPub::create([]));
$form_state = new FormState();
$built_form = $form_builder->buildForm($form, $form_state);
$form_builder->setCache($built_form['#build_id'], $built_form, $form_state);
}
/**
* Tests that non-entity forms can be stored in the form cache.
*/
public function testFormCacheForRegularForms() {
$this->initializeWorkspacesModule();
$this->switchToWorkspace('stage');
$form_builder = $this->container->get('form_builder');
$form_state = new FormState();
$built_form = $form_builder->getForm(SiteInformationForm::class, $form_state);
$form_builder->setCache($built_form['#build_id'], $built_form, $form_state);
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
name: Workspaces
type: module
description: 'Provides the ability to have multiple workspaces on a single site to facilitate things like full-site preview and content staging.'
description: 'Allows users to stage content or preview a full site by using multiple workspaces on a single site.'
version: VERSION
core: 8.x
package: Core (Experimental)