- Issue created by @pdureau
- Merge request !55Issue #3419042 by pdureau: Automatic conversion to SDC & UI Patterns 2.x → (Merged) created by pdureau
- 🇫🇷France mogtofu33
Some minor errors left (detected with ui_patterns_devel):
Component: ui_suite_dsfr:alert [dismissible] Boolean value found, but a string, a number, an integer or an object is required [dismissible] Does not have a value in the enumeration ["","core","custom"] Component: ui_suite_dsfr:link [icon] Does not have a value in the enumeration [...] Component: ui_suite_dsfr:button [icon] Does not have a value in the enumeration [...]
- 🇫🇷France pdureau Paris
I have rebased from 1.0.x branch, and I don't reproduce the issue. Maybe it was fixed by the team.
- 🇫🇷France StephJ
Hello,
i am testing the current code in the MR and found a few minor isues :- the composer.json requires ui_patterns 1.x
- in the alert component, dismissible prop seems problematic. would it be better to have $ref: 'ui-patterns://boolean' instead of an enum
- in the translate component, "links.description" has value "null".thank you
- 🇫🇷France pdureau Paris
Let's use this MR as the first commit of new 1.1.x branch, with those changes:
- the automatic conversion to SDC we are already doing every few days
- + manual stuff:
- the removal of
templates/patterns
folder - the removal of
ui_suite_dsfr_preprocess_pager
- the removal of
ui_suite_dsfr_preprocess_breadcrumb
- replace
pattern()
bycomponent()
:
components/france_connect/france_connect.twig: {{ pattern('link', components/nav_menu/nav_menu.twig: {{ pattern('link', { components/consent_banner/consent_banner.twig: pattern('button', {label: 'Accept all'|t, components/consent_banner/consent_banner.twig: pattern('button', {label: 'Refuse all'|t, components/consent_banner/consent_banner.twig: pattern('button', {label: 'Personalize'|t, components/consent_banner/consent_banner.twig: {{ pattern('button_group', { components/consent_banner/consent_banner.twig:{{ pattern('modal', { components/consent_banner/consent_banner.twig: body: pattern('consent_manager', { components/content_media/content_media.twig: {{ pattern('transcription', { components/consent_manager/consent_manager.twig: {{ pattern('button_group', { components/consent_manager/consent_manager.twig: buttons: [pattern('button', {label: 'Confirm my choices'|t})]
- the removal of
- 🇫🇷France pdureau Paris
We also need to get rid of those 3 preprocesses:
function ui_suite_dsfr_preprocess_pattern_footer_menu(array &$variables) { foreach ($variables['items'] as &$item) { /* Some stuff we can remove... */ // It seems UrlHelper::setAllowedProtocols() doesn't support mailto. if (!str_starts_with(strtolower($item['url']), 'mailto:') && UrlHelper::isExternal($item['url']) && !UrlHelper::externalIsLocal($item['url'], \Drupal::request()->getSchemeAndHttpHost())) { $item['link_attributes']['target'] = '_blank'; } } }
function ui_suite_dsfr_preprocess_pattern_button(array &$variables) { if (empty($variables['url'])) { return; } if ($variables['url'] instanceof MarkupInterface) { $variables['url'] = (string) $variables['url']; } if ($variables['url'] instanceof Url) { $variables['url'] = $variables['url']->toString(); } // It seems UrlHelper::setAllowedProtocols() doesn't support mailto. if (!str_starts_with(strtolower($variables['url']), 'mailto:') && UrlHelper::isExternal($variables['url']) && !UrlHelper::externalIsLocal($variables['url'], \Drupal::request()->getSchemeAndHttpHost())) { $variables['external'] = TRUE; } }
function ui_suite_dsfr_preprocess_pattern_link(array &$variables) { if (empty($variables['url'])) { return; } if ($variables['url'] instanceof MarkupInterface) { $variables['url'] = (string) $variables['url']; } if ($variables['url'] instanceof Url) { $variables['url'] = $variables['url']->toString(); } // It seems UrlHelper::setAllowedProtocols() doesn't support mailto. if (!str_starts_with(strtolower($variables['url']), 'mailto:') && UrlHelper::isExternal($variables['url']) && !UrlHelper::externalIsLocal($variables['url'], \Drupal::request()->getSchemeAndHttpHost())) { $variables['external'] = TRUE; } }
I don't know how to replace them yet. Maybe I will just remove them and create a 1.x issue to restore their logic elsewhere.
- 🇫🇷France pdureau Paris
DONE:
- LinksSettingsType calls removed
- UI Patterns 1.x preprocesses removed
- Switch to new templates in templates/overrides/ui_patterns_library/
Next steps before merging as the first commit of 1.1.x:
- Rebase 1.0.x and run
drush upm ui_suite_dsfr
after ✨ [2.0.0-beta4] Add a stories specific discovery Needs work is merged in UIP2) - If possible, rebase 1.0.x and run
drush upm ui_suite_dsfr
after the release of 1.0.2
Will be moved to dedicated 1.1.x issues (we don't do them now in order to be able to keep rebasing from 1.0.x as long as possible):
- Remove
templates/patterns/
folder and movetemplates/overrides/
totemplates/
- Restore the features lost by the preprocess removal
- Replace
pattern()
Twig function bycomponent()
- Replace
pattern()
Twig function bycomponent()
1.1.x branch will also benefits from:
- 📌 [1.0.2] Add thumbnail.png files Active
- 🇫🇷France pdureau Paris
DONE:
- LinksSettingsType calls removed
- UI Patterns 1.x preprocesses removed
- Switch to new templates in templates/overrides/ui_patterns_library/
- Update ui_examples
- Rebase 1.0.x and run
drush upm ui_suite_dsfr
after ✨ [2.0.0-beta4] Add a stories specific discovery Needs work is merged in UIP2)
Next steps before merging as the first commit of 1.1.x:
- If possible, rebase 1.0.x and run
drush upm ui_suite_dsfr
after the release of 1.0.2
Will be moved to dedicated 1.1.x issues (we don't do them now in order to be able to keep rebasing from 1.0.x as long as possible):
- Remove
templates/patterns/
folder and movetemplates/overrides/
totemplates/
- Restore the features lost by the preprocess removal
- Replace
pattern()
Twig function bycomponent()
- Adopt the new Drupal Core Icon API & UI Icons
1.1.x branch will also benefits from:
- 📌 [1.0.2] Add thumbnail.png files Active
- 🇫🇷France pdureau Paris
DONE:
- Intial
drush upm ui_suite_dsfr
executed - LinksSettingsType calls removed
- UI Patterns 1.x preprocesses removed
- Switch to new templates in templates/overrides/ui_patterns_library/
- Update ui_examples
- Remove Drupal 9 support:
^10.3.4 || ^11
. Abd removeui_patterns_library
dependency. - Rebase 1.0.x and run
drush upm ui_suite_dsfr
after the release of 1.0.2 - Remove
templates/patterns/
folder and movetemplates/overrides/
totemplates/
- Run prettier a last time
Next issues (after this one):
- 📌 [1.1.0] Remove UI Patterns Legacy dependency Active
- 📌 [1.1.x] Convert ID string props to identifier props Active
- 📌 [1.1.x] Manage URL without preprocesses Active
- 📌 [1.1.x] Use "is sequence" Twig test to prevent fatal errors when looping on slots Active
- 📌 [1.1.x] Adopts the new Icon API Active
- 📌 [1.1.0] From Layout Options to UI Patterns 2.x Active
- Intial
Automatically closed - issue fixed for 2 weeks with no activity.