Skip to content
Snippets Groups Projects

Issue #3497000: Add SEO settings section to page data form.

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
  • Ted Bowman
    • Resolved by Ted Bowman

      We currently don't have any tests that add a Page entity via the form, correct? Just wondering what the general state of the Page entity is. Usually would expect to see tests proving the new form fields actually update the entity on save

  • Ted Bowman requested changes

    requested changes

  • Amandeep Singh added 3 commits

    added 3 commits

    • 18d36048 - 1 commit from branch project:0.x
    • 83be622e - Add SEO settings section to page data form.
    • f1303f3e - Create explicit form for xb_page.

    Compare with previous version

  • Matt Glaman requested review from @mglaman

    requested review from @mglaman

  • 18 public function form(array $form, FormStateInterface $form_state): array {
    19 $form = parent::form($form, $form_state);
    20 $group = 'seo_settings';
    21 $form[$group] = [
    22 '#type' => 'details',
    23 '#group' => 'advanced',
    24 '#weight' => -10,
    25 '#title' => t('SEO settings'),
    26 '#tree' => TRUE,
    27 // Not keeping it open messes up media library ajax
    28 // when rendering the form in XB UI.
    29 '#open' => TRUE,
    30 ];
    31 $form[$group]['image'] = $form['image'];
    32 $form[$group]['image']['#weight'] = -10;
    33 unset($form['image']);
    • Comment on lines +31 to +33

      I thought we could add #group to the element and that would move it without reassigning the variable around.

    • I tried with this, but weights were not getting assigned properly due to which order in which the elements appear inside seo settings was incorrect.

    • I'm okay with this approach then if #group wasn't working, for the sake of getting it in versus a rabbit hole of debugging.

    • I agree with @mglaman's original remark.

      If NodeForm::form() can do

          if (isset($form['uid'])) {
            $form['uid']['#group'] = 'author';
          }

      Then this should be able to do something similar.

      If the order is not as desired, then only overriding #weight should be sufficient?

    • Adding #group attribute and then overriding #weight didn't work. It might have worked in Drupal UI but since we are rendering it using react, those weights are not getting picked up. Weights only got picked up when I manually assigned the elements inside seo_settings.

    • :thinking: Then I think @bnjmnm should review this — this sounds like a bug in https://www.drupal.org/project/issues/experience_builder?component=Redux-integrated+field+widgets. This work-around should not be necessary. I'm not opposed to it landing here, but I am opposed to it landing without a @todo pointing to a follow-up issue.

    • I brought down the branch and while #group worked fine, I also encountered the #weight values not being respected for image and description... Regardless of the theme used to render it. A fairly quick way to rule out React rendering is to temporarily change this line in the Theme Negotiator to something other than xb_stark and it will use that theme to render, Twig and everything.

      I switched to Stark and the ordering still ignored #weight for image and description (description is always before image) but I can successfully move the title around with $form['metatags']['widget'][0]['basic']['title']['#weight'] to appear before or after the image/description grouping as needed.

      It makes sense that this is not due to React as that rendering is no more responsible for ordering by weight than Twig is. While something is clearly amiss I'd like us to be careful attributing things to this part of XB with term bug even if it's speculative. The newness of it all is intimidating enough IMO.

      Edited by Ben Mullins
    • Rather than force future XB maintainers to figure all this pain out again, added a comment pointing to @bnjmnm's excellent comment: 61d34a0d

    • Please register or sign in to reply
  • Matt Glaman
  • Can we have an e2e test which edits a page and verifies this organization as well?

  • Matt Glaman requested changes

    requested changes

  • Amandeep Singh added 24 commits

    added 24 commits

    Compare with previous version

  • Matt Glaman approved this merge request

    approved this merge request

  • Matt Glaman requested review from @tedbow

    requested review from @tedbow

  • Matt Glaman requested review from @wimleers and @f.mazeikis

    requested review from @wimleers and @f.mazeikis

  • Matt Glaman requested review from @balintbrews

    requested review from @balintbrews

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