Skip to content
Snippets Groups Projects

Issue #3368656: Add 'Layout' Operation Link to entities

Open Issue #3368656: Add 'Layout' Operation Link to entities
6 unresolved threads
6 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
127 'mode' => 'default',
128 'status' => TRUE,
129 ])->save();
130
131 LayoutBuilderEntityViewDisplay::load("taxonomy_term.$vocabulary_with_section_field_id.default")
132 ->enableLayoutBuilder()
133 ->setOverridable()
134 ->save();
135
136 $this->drupalGet("admin/structure/taxonomy/manage/$vocabulary_id/overview/");
137
138 $assert_session->elementNotExists('xpath', '//table//ul[contains(@class, "dropbutton")]//a[contains(@href, "term/1/layout")]');
139
140 $this->drupalGet("admin/structure/taxonomy/manage/$vocabulary_with_section_field_id/overview/");
141
142 $assert_session->elementExists('xpath', '//table//ul[contains(@class, "dropbutton")]//a[contains(@href, "term/2/layout")]');
  • 151 'administer taxonomy',
    152 'bypass node access',
    153 ]);
    154 $this->drupalLogin($auth_user);
    155
    156 $this->drupalGet('/admin/content');
    157 $assert_session->elementNotExists('xpath', '//table//ul[contains(@class, "dropbutton")]//a[contains(@href, "node/2/layout")]');
    158
    159 $this->drupalGet("admin/structure/taxonomy/manage/$vocabulary_id/overview/");
    160
    161 $assert_session->elementNotExists('xpath', '//table//ul[contains(@class, "dropbutton")]//a[contains(@href, "term/1/layout")]');
    162
    163 $this->drupalGet("admin/structure/taxonomy/manage/$vocabulary_with_section_field_id/overview/");
    164
    165 $assert_session->elementNotExists('xpath', '//table//ul[contains(@class, "dropbutton")]//a[contains(@href, "term/2/layout")]');
    166 }
  • 142 $assert_session->elementExists('xpath', '//table//ul[contains(@class, "dropbutton")]//a[contains(@href, "term/2/layout")]');
    143
    144 // Check for Layout operation link with user without Layout Builder
    145 // permissions.
    146 // Create user without Layout Builder permissions.
    147 $auth_user = $this->drupalCreateUser([
    148 'access administration pages',
    149 'access content overview',
    150 'access taxonomy overview',
    151 'administer taxonomy',
    152 'bypass node access',
    153 ]);
    154 $this->drupalLogin($auth_user);
    155
    156 $this->drupalGet('/admin/content');
    157 $assert_session->elementNotExists('xpath', '//table//ul[contains(@class, "dropbutton")]//a[contains(@href, "node/2/layout")]');
  • 159 $this->drupalGet("admin/structure/taxonomy/manage/$vocabulary_id/overview/");
    160
    161 $assert_session->elementNotExists('xpath', '//table//ul[contains(@class, "dropbutton")]//a[contains(@href, "term/1/layout")]');
    162
    163 $this->drupalGet("admin/structure/taxonomy/manage/$vocabulary_with_section_field_id/overview/");
    164
    165 $assert_session->elementNotExists('xpath', '//table//ul[contains(@class, "dropbutton")]//a[contains(@href, "term/2/layout")]');
    166 }
    167
    168 /**
    169 * Tests language support.
    170 */
    171 public function testLanguage() {
    172 // Rewrite test without dependency on contrib module.
    173 // Skip the test in the meantime (without failing PHPCS).
    174 if (TRUE) {
  • 488 }
    489
    490 return [
    491 'layout' => [
    492 'title' => t('Layout'),
    493 'weight' => 50,
    494 'url' => Url::fromRoute($route_name, $route_parameters, $route_options),
    495 ],
    496 ];
    497 }
    498
    499 /**
    500 * Implements template_preprocess_links().
    501 */
    502 function layout_builder_preprocess_links(&$variables) {
    503 if ($variables['theme_hook_original'] == 'links__dropbutton__operations'
  • Nice work here.

  • Adam Bramley added 260 commits

    added 260 commits

    • a9ca1c8a...12dabf05 - 256 commits from branch project:11.x
    • 8120bff4 - Merge branch '11.x' into 3368656-add-layout-operation
    • 078c8b44 - Use entity ids directly.
    • fd5264ba - Add and fix return type in layout_builder_entity_operation
    • e4b24703 - Use specific preprocess hook

    Compare with previous version

  • 491 'layout' => [
    492 'title' => t('Layout'),
    493 'weight' => 50,
    494 'url' => Url::fromRoute($route_name, $route_parameters, $route_options),
    495 ],
    496 ];
    497 }
    498
    499 /**
    500 * Implements template_preprocess_links().
    501 */
    502 function layout_builder_preprocess_links__dropbutton__operations(&$variables) {
    503 if (isset($variables['links']['layout']['link'])) {
    504 // The 'destination' query parameter is hardcoded by
    505 // \Drupal\views\Plugin\views\field\EntityOperations::render().
    506 // Until https://www.drupal.org/project/drupal/issues/2950883 is committed,
    • This has been committed, but I don't know how we can use that on operation links? Also we probably need test coverage for this.

    • Do we even want to do this? Edit links have a destination so when editing content from an admin screen it's expected that on save you'll be taken back, it could be desirable to have the same for Layout?

    • Yes, that's definitely desirable for me. I'm using the domain module and I use an exposed filter to allow me to manage content on each domain separately.

    • Please register or sign in to reply
    Please register or sign in to reply
    Loading