Issue #3497000: Add SEO settings section to page data form.
Merge request reports
Activity
- Resolved by Amandeep Singh
- Resolved by 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
requested review from @mglaman
- src/Entity/XbPageForm.php 0 → 100644
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']); I agree with @mglaman's original remark.
If
NodeForm::form()
can doif (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? 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 thanxb_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
- Resolved by Wim Leers
added 24 commits
-
f1303f3e...f2057353 - 21 commits from branch
project:0.x
- 49a4a4e5 - Add SEO settings section to page data form.
- d288a8f6 - Create explicit form for xb_page.
- 77b6f62d - Add e2e test confirming the new seo section.
Toggle commit list-
f1303f3e...f2057353 - 21 commits from branch
requested review from @tedbow
requested review from @wimleers and @f.mazeikis
requested review from @balintbrews
- Resolved by Wim Leers
- Resolved by Ted Bowman
- Resolved by Wim Leers
- Resolved by Wim Leers