From b759a939d64fd6f2d2bd21b46c883bb7039692a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=CC=81bor=20Hojtsy?= <gabor@hojtsy.hu> Date: Thu, 13 Jun 2019 14:20:34 +0300 Subject: [PATCH] =?UTF-8?q?Issue=20#3054582=20by=20jeqq,=20blazey,=20Leksa?= =?UTF-8?q?t,=20G=C3=A1bor=20Hojtsy,=20larowlan,=20amateescu:=20Add=20fiel?= =?UTF-8?q?d=20ui=20to=20workspaces?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workspaces/src/Entity/Workspace.php | 1 + .../tests/src/Functional/WorkspaceTest.php | 41 ++++++++++++++++++- .../workspaces/workspaces.links.task.yml | 4 ++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 core/modules/workspaces/workspaces.links.task.yml diff --git a/core/modules/workspaces/src/Entity/Workspace.php b/core/modules/workspaces/src/Entity/Workspace.php index fa08f5630d8b..db7721a32904 100644 --- a/core/modules/workspaces/src/Entity/Workspace.php +++ b/core/modules/workspaces/src/Entity/Workspace.php @@ -44,6 +44,7 @@ * revision_table = "workspace_revision", * data_table = "workspace_field_data", * revision_data_table = "workspace_field_revision", + * field_ui_base_route = "entity.workspace.collection", * entity_keys = { * "id" = "id", * "revision" = "revision_id", diff --git a/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php b/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php index e4b13188c514..0352633ce8ca 100644 --- a/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php +++ b/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php @@ -16,7 +16,7 @@ class WorkspaceTest extends BrowserTestBase { /** * {@inheritdoc} */ - public static $modules = ['workspaces', 'toolbar']; + public static $modules = ['workspaces', 'toolbar', 'field_ui']; /** * A test user. @@ -141,4 +141,43 @@ public function testWorkspaceFormRevisions() { $this->assertEquals('3', $live_workspace->getRevisionId()); } + /** + * Tests adding new fields to workspace entities. + */ + public function testWorkspaceFieldUi() { + $user = $this->drupalCreateUser([ + 'administer workspaces', + 'access administration pages', + 'administer site configuration', + 'administer workspace fields', + 'administer workspace display', + 'administer workspace form display', + ]); + $this->drupalLogin($user); + + $this->drupalGet('admin/config/workflow/workspaces/fields'); + $this->assertSession()->statusCodeEquals(200); + + // Create a new filed. + $field_name = mb_strtolower($this->randomMachineName()); + $field_label = $this->randomMachineName(); + $edit = [ + 'new_storage_type' => 'string', + 'label' => $field_label, + 'field_name' => $field_name, + ]; + $this->drupalPostForm("admin/config/workflow/workspaces/fields/add-field", $edit, 'Save and continue'); + $page = $this->getSession()->getPage(); + $page->pressButton('Save field settings'); + $page->pressButton('Save settings'); + + // Check that the field is displayed on the manage form display page. + $this->drupalGet('admin/config/workflow/workspaces/form-display'); + $this->assertText($field_label); + + // Check that the field is displayed on the manage display page. + $this->drupalGet('admin/config/workflow/workspaces/display'); + $this->assertText($field_label); + } + } diff --git a/core/modules/workspaces/workspaces.links.task.yml b/core/modules/workspaces/workspaces.links.task.yml new file mode 100644 index 000000000000..a2bfd079f485 --- /dev/null +++ b/core/modules/workspaces/workspaces.links.task.yml @@ -0,0 +1,4 @@ +entity.workspace.collection: + title: 'List' + route_name: entity.workspace.collection + base_route: entity.workspace.collection -- GitLab