![]() Since then, Mateu has been writing the code for the module, and discussing architectural decisions with Lauri, me, and other developers. The vision was heavily inspired by Mateu’s work on the CL Components suite of modules, which provides similar base functionality (and much more). Mateu, Lauri, and I started discussing SDC in October 2022. This means that in the future, modules will automatically detect components and insert their respective forms into Layout Builder, CKEditor, Paragraphs, Blocks, Fields, etc! In addition, you’ll be able to integrate your SDC components directly into Storybook or other component library managers! Background on Single Directory Components (SDC) SDC will automatically generate the library and load it when the component is called.īecause we define the schema within a component’s YAML definition, modules can automatically create forms to populate data. Var originalThrobber = ĭ directory components (SDC) is the biggest paradigm shift in Drupal since the introduction of Twig in 2013! At its core, SDC allows you to gather related files from a component (CSS, JS, Twig), and group them into one directory. if the element had something specified. Override the progress throbber, to actually use a different progress style It falls back to Drupal's original method when the progress type isn't specified in a ' data-progress-type' attribute. Back in my ajax-overrides.js file, I've added this snippet to override the standard 'throbber' progress type that AJAX links would otherwise always use. Since that only gets applied to form elements, not arbitrary links using the ' use-ajax' class, we have to do the work to pick this up ourselves. I want this to work similarly to the $element property that can be set on form elements that use AJAX. I've already added the ' data-dialog-type' attribute to my link, so now I just add a ' data-progress-type' attribute, with a value of ' snowman'. Part 3, adding a custom attribute to specify that our AJAX link should use a Snowman animation, is easily achieved. Given that the styling of the default spinner happens to make links & lines jump around, I've got the ajax-progress-fullscreen class in there, to be more like the 'full screen' graphic that the Views UI uses, and avoid the need to add too much more styling myself. ajax-progress-snowman appropriately, to show a lovely snowman in the middle of the page, rather than a tiny blue spinner next to the link that triggered the AJAX. theme file:įunction MYTHEME_library_info_alter(&$libraries, $extension) )(jQuery, window, Drupal, drupalSettings) So I implemented hook_library_info_alter() in my theme's main. But I decided I wanted to treat my work as if it were part of Drupal's core AJAX library itself, rather than something to add separately. Usually, you would define a library and add it with #attached. There are many ways to achieve points 1 and 2. ![]() Override Drupal core's javascript method that adds the standard progress throbber, to respect that custom attribute.Set a custom attribute on the link that will trigger the AJAX.Ensure the javascript file containing the method is included on the page.Create a javascript method that will add a custom progress indicator.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |