Quantcast
Channel: Issues for Drupal core
Viewing all 293641 articles
Browse latest View live
↧

Enforce comformance to W3C recommendations on radio buttons?

$
0
0

Spill-over from #569542: Button Option Field is Required, has One Option - Select that Option and #368771-24: Create Documentation about removing N/A option for not required radio buttons:

From http://www.w3.org/TR/html401/interact/forms.html#h-17.2.1 (I tried to find an XHTML version of this section, and failed):

If no radio button in a set sharing the same control name is initially "on", user agent behavior for choosing which control is initially "on" is undefined. [snip] Since user agent behavior differs, authors should ensure that in each set of radio buttons that one is initially "on".

See also http://www.ietf.org/rfc/rfc1866.txt

The recommendation is basically saying that there should never be a situation where radio buttons appear that do not have one of the options pre-selected. Mainly, I guess, because you can never "un" select one of the options in a list of radios once you click into it. If you want a control where users have to explicitly choose something, you should use a select box instead which can have a 'neutral' option.

What CCK (and presumably Field UI) does is, for required fields, always select the first one in the list. For non-required fields, it automatically creates an "N/A" option to give people the ability to not fill out the field.

Basically, I guess the question is... should Form API enforce this recommendation, and disallow radio button controls without a #default_value (probably defaulting to the first option if none is selected)? People who still wanted "N/A" as one of the choices could still add it in there as one of the $options.

Anyone here web a standards geek?

↧

Changing the site default language after install results in complex breakages

$
0
0

Problem/Motivation

The switching default language does not account for configuration translations, locale_modules_installed() and \Drupal\locale\LocaleConfigSubscriber.

Steps to reproduce

  1. Install Drupal standard in English
  2. Enable the locale module
  3. Add another language (for example German) on admin/config/regional/language
  4. Change the default language to the one you just added

Changing the default language will not make any changes to configuration. If you export at this point you will have a language/de folder in your configuration sync. If you export before step 4 and then export after you will only see that only system.site and language.negotiation need re-exporting.

If you then install a module (for example jsonapi) massive configuration change will occur. A language/en folder will be created. All default configuration will be changed to 'de' and translated.

Also, if you switch default language back to English, the configuration language for existing config never switches back, not even when you install more modules.

Proposed resolution

Fix up configuration after changing the default language. Say the old default language was 'en' and the new language default language is 'de' - we will need to start a batch that:

  1. Creates a language/en collection and moves the current english strings from the default collection there.
  2. Changes the langcode of all default collection configuration to 'de' - see locale_system_set_config_langcodes()
  3. Merges the translations that are in language/de to the default collection.
  4. Removes the language/de collection

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

↧
↧

Upgrade filter system to HTML5

$
0
0

Problem/Motivation

The filter system should be upgraded to HTML5 to match modern standards. All modern browsers now parse HTML5, our themes use an HTML5 doctype and so Drupal should treat HTML input and output the same way.

Steps to reproduce

Currently the filter system parses and outputs XHTML only. This causes PHP warnings when trying to parse modern tags:

>>> use \Drupal\Component\Utility\Html;
>>> Html::normalize("<p><figure><figcaption>Caption</figcaption></figure><video></video></p>");
PHP Warning:  DOMDocument::loadHTML(): Tag figure invalid in Entity, line: 1 in /var/www/html/drupal/core/lib/Drupal/Component/Utility/Html.php on line 289
PHP Warning:  DOMDocument::loadHTML(): Tag figcaption invalid in Entity, line: 1 in /var/www/html/drupal/core/lib/Drupal/Component/Utility/Html.php on line 289
PHP Warning:  DOMDocument::loadHTML(): Tag video invalid in Entity, line: 1 in /var/www/html/drupal/core/lib/Drupal/Component/Utility/Html.php on line 289
=> "<p><figure><figcaption>Caption</figcaption></figure><video></video></p>"

Also, <br /> and <img /> tags are self-closing. In HTML5, these are void elements and should be output simply as <br> and <img>.

Proposed resolution

Use masterminds/html5 instead of DOMDocument to parse and output HTML in the \Drupal\Component\Utility\Html utility class.

Remaining tasks

User interface changes

None

API changes

\Drupal\Component\Utility\Html::load(), \Drupal\Component\Utility\Html::serialize() and \Drupal\Component\Utility\Html::normalize() will parse and output HTML5 instead of XHTML. Input filters or other code that relies on this utility class will also now parse and output HTML5 instead of XHTML.

This does mean there are some minor changes to output, but these should not affect valid HTML documents. Invalid HTML may have some minor changes, e.g. <br></br> was previously corrected to <br> alone, but now is corrected to <br><br> following the HTML5 parsing model.

Data model changes

None

Release notes snippet

The filter system has been upgraded to output HTML5.

↧

[meeting] Migrate Meeting 2023-06-15 1400Z

$
0
0

Hello all, it’s time for the biweekly migration subsystem meeting. The meeting will take place in slack in various threads
This meeting:
➀ Is for core migrate maintainers and developers and anybody else in the community with an interest in migrations
➀ Usually happens every second Thursday and alternates between 1400 and 2100 UTC.
➀ Is done on the #migration channel in Drupal Slack (see www.drupal.org/slack for information).
➀ Happens in threads, which you can follow to be notified of new replies even if you don’t comment in the thread. You may also join the meeting later and participate asynchronously!
➀ Has a public agenda anyone can add to. See the parent issue for an idea of the typical agenda.
➀*Transcript will be exported and posted* to the agenda issue. For anonymous comments, start with a :bust_in_silhouette: emoji. To take a comment or thread off the record, start with a :no_entry_sign: emoji.

Core migration issues

Next video meeting 2023-07-27 2100Z (tentative)

0️⃣ Who is here today?

mikelutz (he/him)Hello
Dan DavisPresent - I am a newcomer to the migration group. Long time user, working on finding ways to contribute.
StephanieHi - also looking to be contributing more

1️⃣ What should we talk about today? Suggest topics here and I will add threads. I will also check for comments on the issue for today's meeting.

mikelutz (he/him)#3247718: Allow process plugins to flag a row to be skipped

2️⃣ Action items. To be added later.

benjifisherReview #3007709: Add XPath-style filtering ability in JSON data parser plugin. @benjifisher
benjifisherReview #3063856: Expose full set of debugging data in migrate_message table (filterable/searchable). @benjifisher
benjifisherAdd some documentation for #3358569: Change plugin class for comment/user migration to the standard migration plugin class. @mikelutz (he/him)
benjifisherReview #3247718: Allow process plugins to flag a row to be skipped. @benjifisher

3️⃣ Statistics

benjifisherFixed in the last 2 weeks: 1 (not counting issues for meetings). Another 2 in the previous two weeks.
benjifisherRTBC: 3, all Normal priority, 1 has not been updated in more than 1 month.
benjifisherNR: 1, including 1 Major.
benjifisherNeeds subsystem maintainer review: 8
benjifisherGoogle sheet for recording stats: https://docs.google.com/spreadsheets/d/1o0Rjlc1vnnLP5bM5P-SMMyGzqn7258hi...

4️⃣ Comment in this thread if you are looking for ways to contribute. Give us some idea of what you would like to do: documentation, code review, testing, project management, ...

Dan DavisDocumentation, code review, testing for me.
benjifisher@Dan Davis:Β  Are you interested in working on the issue in 9️⃣?
Dan DavisReviewing now

5️⃣ Previous minutes.

benjifisherWe skipped the 2023-06-01 meeting. Previous meetings have transcripts and are Closed (fixed). The latest was 2023-05-18: #3360195: [meeting] Migrate Meeting 2023-05-18 1400Z.

6️⃣ Announcements

benjifisherDrupal 7 EOL is set for 2025-01-05, and there will be no more extensions.

The DA is working on a partner program for those who provide migration services. It is still in the early stages. For example, when asked about whether individual contractors can apply for the program, Tim Lehnen said they should think about it.

https://www.drupal.org/psa-2023-06-07

7️⃣ Consolidate code in the migrate_drupal module.

mikelutz (he/him)Had a number of discussions regarding this and the future of migrate in Drupal core with the committers at DrupalCon.
mikelutz (he/him)There isn’t a lot of consensus on how to proceed yet.Β  One option discussed is to deprecate the d7/d6 stuff in Drupal 11 and NOT move it to contrib, in which case we don’t want to do the work to consolidate everything.Β  We are going to have further dscussions at the next video meeting and the committers are going to have further disucssions as well.Β  We probably want to postpone the issues here until those discussions are completed.
mikelutz (he/him)We should definitly add it to the agenda for the next video meeting, (scheduled for July 27th atm). We should invite committers to join that meeting, Gabor/Nat/Jess and/or Alex if he’s back from holiday.
mikelutz (he/him)And lets keep bringing it up in this meeting too.Β  Everybody is busy with 10.1 right now, but if we don’t keep pressing for a decision, It’s going to slip through the cracks.
mikelutz (he/him)And we want to have a decision by the end of the summer as it will dictate what we can or can’t do in 10.2 to prepare.
heddnhmm, I like deprecate and remove in d12. less busy work.
benjifisherThe 21:00 UTC meetings conflict with the biweekly triage meeting for the security team. We may want to reschedule.

8️⃣ Add XPath-style filtering ability in JSON data parser plugin

benjifisher#3007709: Add XPath-style filtering ability in JSON data parser plugin
benjifisher@Stephanie did some manual testing last week during DrupalCon. It still needs code review. If I do a review and decide it needs some minor changes, is anyone available to make the updates?
StephanieI should have bandwidth for that.

9️⃣ Expose full set of debugging data in migrate_message table (filterable/searchable)

benjifisher#3063856: Expose full set of debugging data in migrate_message table (filterable/searchable)
benjifisherThis issue is now un-postponed since #3312733: SQL migrations cannot be instantiated if database is not available and Node, Migrate Drupal modules are enabled was Fixed a few days ago.
benjifisherCan someone check whether the patch in #141 still applies? When it was posted, it failed static analysis:
Running PHPStan on *all* files.
 ------ -------------------------------------------------------------------------------------- 
  Line   core/modules/migrate_drupal_ui/tests/src/Functional/MigrateMessageControllerTest.php  
 ------ -------------------------------------------------------------------------------------- 
  49     Missing call to parent::setUp() method.                                               
 ------ --------------------------------------------------------------------------------------

That should be pretty easy to fix.

benjifisherI set the status to RTBC in #138, but @alexpott asked for changes in #139. Someone should confirm that the patch in #141 implements those changes.
benjifisherWhy did I set the status to RTBC before #3312733 was Fixed? It was fixed, but then it was reverted because tests failed with SQLite. It is now re-Fixed.

1️⃣0️⃣ Change plugin class for comment/user migration to the standard migration plugin class

benjifisher#3358569: Change plugin class for comment/user migration to the standard migration plugin class
mikelutz (he/him)This one has been coming up more and more in slack lately, where people can’t figure out why their custom processes don’t work in comment and user migrations, and it’s generally traced back to using the core migrations as a starting point, which use a custom migration class to dynamically inject processes.
benjifisher@mikelutz (he/him): This one is for you!

I think we skipped the 2023-06-02 meeting. You left a note on the issue for the previous meeting:

Reminder for myself to discuss #3358569: Change plugin class for comment/user migration to the standard migration plugin class at this meeting. It's been coming up a lot in slack lately, and I think we need to at least improve documentation around the issue.

mikelutz (he/him)I don’t think there is anything to do in core, but I’m thinking we can add some stuff in migrate_upgrade to adjust those migrations on export so people are starting with a more standard starting point.Β  At minimum we need to probably document this somewhere along with the migrate_plus/migrate_upgrade workflow as it’s a common thing that’s overlooked.
benjifisherMake that the 2023-06-01 meeting (off by a day). I will re-purpose that issue for today's meeting.
mikelutz (he/him)hmm, I don’t recall intentionally skipping that meeting, but I was on vacation that week, I may not have seen the reminder for it and forgot about it. My bad.
mikelutz (he/him)Given attendence at the later meeting lately, I’m guessing no one noticed, lol.
benjifisherMaybe this is a good page to add some documentaiton: https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-6-or-...
mikelutz (he/him)My calendar has been messed up since we dropped to every two weeks too, I’ve fixed it but that one may not have been on my calendar.
mikelutz (he/him)Anyway, either document or fix migrate_upgrade to adjust those on export.Β  but changing the export is probably tricky to do in general, and things like user_profile might make it tough.Β  There’s also #3005718: D7 comment migration does not properly migrate fields by comment bundle.
mikelutz (he/him)Maybe comments should be bundled after all and not use a custom class anyway.
mikelutz (he/him)Oh.. I made that issue. huh.
benjifisherDon't you love your past self? :wink:
mikelutz (he/him)Am I right, are comments bundlable in d7, but we just try to migrate everything in one go?Β  I feel like I remember seeing that 5 years ago, but haven’t given it much thought since then.Β  I haven’t really migrated many sites with comments in my recent career.
benjifisherI do not know.

1️⃣1️⃣ Allow process plugins to flag a row to be skippedΒ (edited)Β 

benjifisher#3247718: Allow process plugins to flag a row to be skipped
benjifisherI owe you a re-review of that one.

1️⃣2️⃣ Wrap up

benjifisherThanks for participating! I will update 2️⃣. Please continue to add comments in the threads. In 1-7 days, we will post a transcript for today's meeting.
benjifisherIt is great to see some more participation in today's meeting! I have to get to my day job now, but I will add action items later, and maybe even work on the ones assigned to me.
Dan DavisThank you @benjifisher!

Participants:

↧

[drupalImage] Split DrupalImageEditing into multiple plugins

$
0
0

Problem/Motivation

DrupalImageEditing is currently responsible for all image model-view conversions which makes it a bit overwhelming. Most of the code is in various convertors which can be easily moved to different plugins.

Proposed resolution

Split DrupalImageEditing into multiple plugins

Remaining tasks

User interface changes

API changes

Data model changes

↧
↧

remove page_top & page_bottom from theme info

$
0
0

Is it safe to remove page_top & page_bottom from custom theme .info file?? or it's required for every themes.

function system_system_info_alter(&$info, $file, $type) {
  // Remove page-top from the blocks UI since it is reserved for modules to
  // populate from outside the blocks system.
  if ($type == 'theme') {
    $info['regions_hidden'][] = 'page_top';
    $info['regions_hidden'][] = 'page_bottom';
  }
}
// Render page_top and page_bottom into top level variables.
  $variables['page_top'] = drupal_render($variables['page']['page_top']);
  $variables['page_bottom'] = drupal_render($variables['page']['page_bottom']);

Seems like it injects page_top&bottom to every theme even it's not defined.

↧

Warning: Undefined array key "function" in Drupal\Core\Utility\Error::getLastCaller() (line 130 of core/lib/Drupal/Core/Utility/Error.php).

$
0
0

Problem

Sometimes I see this message on screen: "Warning: Undefined array key "function" in Drupal\Core\Utility\Error::getLastCaller() (line 130 of core/lib/Drupal/Core/Utility/Error.php). "

Proposition

Need to add checking on key existing.

↧

Method attributes to implement hooks (hux style)

$
0
0

Problem/Motivation

Currently in Drupal we have the old procedural hook system, we have symfony events, and we have tagged services and service collectors, to allow different modules or components broadcast or respond to "events" (in the broader sense).

The procedural hook system has a number of problems and limitations (some already mentioned in #2237831):

  • Possibility of name clashes / ambiguity, e.g. "field" + "_group_permission" vs "field_group" + "_permission".
  • No dependency injection: Hook implementations have to call \Drupal::service(...) to get their dependencies.
  • Most implementations are in *.module files, which can get crowded, make it hard to organize code, and can easily cause git merge conflicts, if multiple branches attempt to add new hook implementations.
  • There can be only one implementation per module (or the module has to "cheat", and pretend it is implementing on behalf of another module, one that might not even exist).
  • The procedural code feels out of place compared to the rest of Drupal.

Alternatives:

  • symfony events require a dedicated event class per event type instead of named parameters, which "creates additional boilerplate when defining events and additional levels of indirection when subscribing to events." (quote from #2237831). See #2551893: Add events for matching entity hooks
  • tagged services and services collectors typically require a dedicated interface per "event type", and subscribers (= tagged services) to implement that interface.

None of these "alternatives" is a good candidate to fully and generically convert the existing hook system. All past attempts to do so (that I am aware of) only focused on very specific hooks, or families of hooks.

Proposed resolution

The Hux module allows to mark methods on services classes as hook implementation, using php attributes.

Something similar should be added in Drupal core, so that existing hook implementations can be converted to OOP code.

This seems to be the current consensus in #2237831: Allow module services to specify hooks.

class MyService {
  #[Hook('node_insert'), Hook('node_update')]
  public function nodeWrite(NodeInterface $node): void {..}
  #[Alter('form_node_edit_form')]
  public function nodeFormAlter(array $form, FormStateInterface $form_state): void {..}
}

Goals / requirements

Backwards support:

  • The first iteration of this should be fully compatible with existing procedural hook implementations and also on the calling code side.
  • There will be a mix of procedural and non-procedural implementations.
  • The old hook_module_implements_alter() will still work on the list of procedural implementations, but a new hook (or event?) could be added to reorder or alter the collection that includes OOP implementations.
  • The behavior and return value of any call to $module_handler->invoke() or $module_handler->invokeAll() etc...
    • ...must remain unchanged, if no new implementations were added.
    • ...must remain unchanged, if existing implementations are merely converted to the new system.
    • ...must only gradually change, if new implementations are added using the new system.
  • Modules can start implementing existing hooks using the new system, without any change in the module that publishes or invokes the hook.

Basic new features:

  • Methods on service classes can subscribe to hooks using attributes like #[Hook('node_update')].
  • One method can implement more than one hook.
  • Multiple methods in the same module can implement the same hook, resulting in multiple implementations per module.
    This introduces some challenges with return value of single $module_handler->invoke(..), see below.
  • There must be a mechanism to order different implementations. E.g. in hux there is a system of weights / priorities, but in core we might do something different.
  • There must be a mechanism to replace or remove existing implementations.
  • For the two requirements above, it might be necessary to have unique machine names for individual implementations.

Optional or advanced features:

  • There can be a discovery mechanism to register classes with hooks as services. E.g. in hux, this happens if these classes are in a Drupal\\$modulename\\Hooks namespace.
  • Modules can add additional attribute classes, to let the method implement one or more hooks. E.g. #[HookEntityOp(['node', 'taxonomy_term'], ['update', 'insert'])] would implement 4 different hooks.
  • Modules can add other callbacks as hook implementations, that don't rely on php attributes, and that can be added dynamically.
  • We might add additional methods to ModuleHandler, with more control of the results aggregation for single ->invoke(). See "Challenges" below.
  • We might add hooks (or anoother mechanism) to control the default results aggregation per hook name.

Challenges

  • Return value of single $module_handler->invoke():
    • Currently, it returns the return value of the one single implementation. The behavior for this case must not change!
    • With multiple implementations that return arrays, e.g. for hook_schema(), we would expect the results to be merged. Any null values would be skipped, if the "collected data" is already an array.
    • For more than one non-array non-null values, or a mix of array and non-array values, an exception could be thrown, because these cannot be merged, unless an aggregation method is specified somewhere.
  • Design a system to define order of implementations, and to remove or replace implementations. Options:
    • Before/after rules, as proposed for events in #2352351: Add before/after ordering to events
    • Numeric weights/priorities, as currently in hux.
    • A hook or similar to alter the list of implementations, similar to hook_module_implements_alter(), but with support for callbacks.
    • Extending hook_module_implements_alter() in a BC-friendly way. This could be tricky.

Underlying architecture

The module handler ->invoke(), ->invokeAll() etc should operate with a list of callbacks, that can come from different sources.
The methods with attributes will be one such source, but it should be flexible enough to support other sources.

Proposed roadmap / target versions

  • Study and play with the hux module as a proof of concept.
  • Build the new system in latest version of Drupal 10 (10.2.x). Do not change the existing implementations and calling code, yet.
    This allows contrib to start using the new system, while minimizing disruption from upgrading to the new core version.
    Any possible BC conflict will only apply if there is a module that uses the new system.
  • Start converting existing implementations in a future version - 10.? or 11 - depends how disruptive this turns out to be.
  • Add additional changes that are not backwards compatible, consider to deprecate procedural hooks, in Drupal 11.

Remaining tasks

User interface changes

API changes

Methods in service classes can be marked as hook implementations using attributes.
Details are provided above.

Data model changes

Caches for the new kinds of implementations and discovery data.

Release notes snippet

↧

Do not prepopulate the user register form with the email address and username of the last person who registered using the same web browser

$
0
0

Whenever I create a new account It asks for email, user name and etc but It takes the same credentials in the respective fields that I have used for previous user creation and I think drupal doesn't allow to use same email for 2 or more different people.
I think it's storing on local but there is no use of it.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue categoryBug because this is a regression in privacy from previous versions of Drupal (Drupal 7).
Issue priorityMajor because this issue goes against general privacy expectations from an end-user standpoint.
Prioritized changesThe main goal of this issue is usability. Having a previous user’s β€œprivate” email or username displayed to any following user who happens to access user/register on a given machine is counterintuitive and violates reasonable privacy expectations.
↧
↧

Refactor Claro's form--select stylesheet

$
0
0

Problem/Motivation

This is part of the CSS modernization initiative.

Steps to reproduce

The stylesheet at https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/themes/claro/css/components/form--select.pcss.css needs to be refactored to make use of modern CSS and Drupal core's PostCSS tooling.

Proposed resolution

Use CSS Logical Properties where appropriate
Use CSS nesting where appropriate

Remaining tasks

We need two patches. One for Drupal 9.5.x and one for Drupal 10.0.x
We need a followup issue to refactor this component in Drupal 10.0.x to make use of component-level CSS custom properties and remove IE specific style definitions.

User interface changes

None. There should be no visual differences.

↧

Improve menu parent link selection

$
0
0

Executive summary: A new FAPI special field type of hselect.

During the last session of of the Google Drupal Usability Survey, "This is crazy in here" was uttered when opening up the Parent item select input of the Menu Settings. By default, it was including every single possible menu item in one giant select list which can be a little crazy.

Which menus are included in that list is configurable so that things like the Navigation menu do not end up in there, but even without that, a giant select field full of every menu item is confronting.

One possible solution to this was to include something like hierarchial select into the core. I thought I'd try to use the existing #ajax infrastructure since I have no chance of putting all of HS into core ;) If someone is so brave (Wim?), they can give it go!

After looking at how it worked on the inside, it seemed that the form_alter approach that HS took because it is a contrib module is great but it doesn't seem like the right way to attack the issue when it's in core and we're adding the item in the first place.

For that, I'm proposing a new field type be added to FAPI - 'hselect' (feel free to give a better machine name .. I'm not sold on it).

This would allow any module to use this method of getting a single value out of a large tree of options where only the available options at a particular level are actioned at a time. It does this by breaking up the levels into multiple select options based on the given #options array in the #process function. There is a @todo in there to generate the whole list with a #process function, but that seems difficult to deal with in other hook_form_alters .. I know it drove me up the wall the last time I ran into a form that did that. No way to slightly change the options, just completely replace them.

eg an example of what it would look like in the declaration

// This would normally be generated, but this is for an example
$default = 'main-menu:0';
$options = array(
  'main-menu:0' => array(
    '#title' => 'Main menu',
    'main-menu:137' => 'Home',
    'main-menu:138' => 'Contact',
  ),
  'management:0' => array(
    '#title' => 'Management',
    'management:1' => array(
      '#title' => 'Administration',
      /* etc. skipping the full array for now */
      'management:8' => 'Content',
      'management:6' => 'Appearance',
    ),
  ),
);
$form['my_hselect'] = array(
  '#type' => 'hselect',
  '#title' => t('Parent item'),
  '#default_value' => $default,
  '#options' => $options,
  '#attributes' => array('class' => array('menu-parent-hselect')),
);

The present #process function of form_process_hselect would then process it into the following

$form['my_hselect'] = array(
  '#type' => 'hselect',
  '#title' => t('Parent item'),
  '#default_value' => $default,
  '#options' => $options, /* needs to be kept as a local reference to build the sub-selects */
  '#attributes' => array('class' => array('menu-parent-hselect')),

  'hselect' => array(
    '#tree' => TRUE,

    0 => array(
      '#type' => 'select',
      '#options' => array(
        'main-menu:0' => 'Main menu',
        'management:0' => 'Management',
      ),
      '#default_value' => 'main-menu:0',
      '#attributes' => array('class' => array('menu-parent-hselect-level-0')),
    ),

    1 => array(
      '#type' => 'select',
      '#options' => array(
        '_none' => ' - select - ',
        'main-menu:137' => 'Home',
        'main-menu:138' => 'Contact',
      ),
      '#attributes' => array('class' => array('menu-parent-hselect-level-1')),
    ),
  ),
);

The returned value would be in $form_state['values']['my_hselect'] from the example above, and all other sub-select would go bye bye, just like with radios. At present, this aspect is borked.

I've made a start but I'd rather get the conversation going before putting this entirely into code only to have someone point out a much better way to do it (or what the @todo about putting the whole creation of #options into a #process .. maybe #options_callback would be a better way to go if we're already screwing with the api). It would be a neat feature to have available in core though as it could break down any large single leaf tree selects.

I'm fairly near the limit of what I know about making a new select type in there. I can get the ajax bit working with #ajax, but at present it needs POST processing of some kind to get rid of the invalid input values as I don't think I've done all the functions required. I'm also pretty much out of time for a bit now.

↧

Make 'sequence' Typed Data instances return type of 'sequence' instead of 'list'

$
0
0

Problem/Motivation

#2361539: Config export key order is not predictable for sequences, add orderby property to config schema introduced \Drupal\Core\Config\Schema\SequenceDataDefinition, a subclass of \Drupal\Core\TypedData\ListDataDefinition which was used until then.

This new class was associated with the sequence config schema type. Everything's been working fine.

But because the new SequenceDataDefinition did not override \Drupal\Core\TypedData\ListDataDefinition::getDataType(), the returned data type is still wrong.

This has not mattered in the >10 years that have passed since #1866610: Introduce Kwalify-inspired schema format for configuration introduced the concept of config schemas nor in the almost 9 years since #2277945: Typed configuration implements TypedDataInterface improperly added typed data integration:

sequence:
  label: Sequence
  class: '\Drupal\Core\Config\Schema\Sequence'
  definition_class: '\Drupal\Core\TypedData\ListDataDefinition'

… but then again:

  1. \Drupal\Core\TypedData\ListDataDefinition is atypical because it overrides the inherited \Drupal\Core\TypedData\DataDefinition::getDataType() which would've returned the correct value
  2. It's only now that we're getting serious about config validation (see #2164373: [META] Untie config validation from form validation β€” enables validatable Recipes, decoupled admin UIs …), which is why I discovered it in #3216089: Expose validation constraints (and validatability %) in Config Inspector UI.

Steps to reproduce

N/A

Proposed resolution

Tests + fix.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

N/A

↧

Move URL alias functionality into a Path API module (still separate from the Path UI)

$
0
0

[tha_sun] If URL aliases can be optional, then there is no point in supporting them in the first place. Add hook_foo(), move that stuff into Path module.
[tha_sun] + if you want to, convert Path into Path + Path UI module.
[tha_sun] Or, better yet, Alias + Alias UI module.
[tha_sun] Am I mistaken, or will http://drupal.org/node/370454 eliminate that path alias bootstrap issue?
[Druplicon] http://drupal.org/node/370454 => Simplify page caching => Drupal, base system, normal, needs work, 19 IRC mentions

[catch] tha_sun: you mean for cached pages? I think so yeah.
[tha_sun] The question is: What prevents Path module from implementing hook_boot() ?
[catch] tha_sun: for drupal_init_path()?
[tha_sun] catch: not sure, basically yes...
[catch] tha_sun: probably not a lot.
[catch] tha_sun: also, we should de-op drupal_lookup_path()
[tha_sun] de-op?
[catch] drupal_lookup_path_alias() drupal_lookup_path_source()
[catch] drupal_static_reset()
[tha_sun] ah, de-$op
[catch] tha_sun: in that case, do we need path.inc at all?
[tha_sun] so, we should fix the cause.
[tha_sun] Interesting question
[tha_sun] :)
[catch] arg() is in there.
[catch] But could move to common.inc I think.
[tha_sun] huh?!
[tha_sun] catch: hook_boot() would run much earlier than DRUPAL_BOOTSTRAP_PATH is running now
[catch] tha_sun: arg() could move to common.inc
[tha_sun] sure thing
[catch] why is drupal_get_title in here?
[tha_sun] LOL
[tha_sun] Let's move check_markup() in there!
[catch] tha_sun: the only one that'd cause serious problems is drupal_is_front_page() if that gets used a lot.
[tha_sun] catch: That has nothing to do with URL aliases?
[catch] drupal_is_front_page?
[Druplicon] drupal_is_front_page: Check if the current page is the front page. => drupal_is_front_page() => http://api.drupal.org/api/function/drupal_is_front_page/6
[catch] tha_sun: apparently it does.
* catch never knew.
[catch] tha_sun: but looks like we should just store normal path for site front page same as the menu system does for links.
[tha_sun] catch: I'm looking at that monolothic path.inc right now. It just converts site_frontpage into a Drupal path. Guess what?
[tha_sun] heh
[tha_sun] system_site_settings_submit?
[tha_sun] bah
[tha_sun] system_site_information_settings_validate?
[Druplicon] system_site_information_settings_validate: Validate the submitted site-information form. => system_site_information_settings_validate($form, &$form_state) => http://api.drupal.org/api/function/system_site_information_settings_vali...
[tha_sun] We already validate.
[tha_sun] We just don't alter.
[catch] nice.
[tha_sun] Most probably -- a UX issue :P
[tha_sun] WTF? I'VE TOLD YOU! MY FRONTPAGE IS eat-my-dog-food NOT node/128412841234
[catch] tha_sun: if we do it for menu items, then they can go and die for the front page.
[catch] tha_sun: or we can remove all of path.inc down to that one function.
[tha_sun] But, who says that we can't invoke drupal_get_path_alias() for that #default_value ..? ;)
[catch] tha_sun: if module_exists('path') drupal_get_path_alias()
[tha_sun] (if Path module is enabled)
[catch] ugh, but yeah.
[catch] tha_sun: path.module could form alter!
[tha_sun] heheh :)
[tha_sun] yay!
[Druplicon] yeeeeeeeeeeeeeeeeeha!
[catch] tha_sun: mind if I paste this into a new issue.
[tha_sun] catch: JohnAlbin-style? "DIE path.inc DIE!!!" :-D
[catch] tha_sun: I'd already typed "path.inc your time has come"

↧
↧

New non translatable field on translatable content throws error

$
0
0

Problem/Motivation

Even when access is denied to a widget, the value submitted propagates to the entity built from the sum of widgets.

Steps to reproduce

  1. Enable at least content translation and content moderation modules and some entity providing module, node is typical.
  2. Set Hide non translatable fields on translation forms on the content translation admin form.
  3. Create an entity.
  4. Now add a nontranslatable field with a non-null default value.
  5. Try to add a non-default revision translation of the entity.
  6. Kaboom courtesy of EntityUntranslatableFieldsConstraint as the non-null value changes to the default. (error message "Non-translatable fields can only be changed when updating the original language.")

Proposed resolution

Don't let widgets pass their values when access is denied to them.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Original report by pavlosdan

We use *Paragraphs + Content Moderation + Translations*. We have a lot of content that is moderated and translated. We've added a new field in one of the paragraphs that did not need to be translatable (it's a checkbox that should be the same across translations) but we noticed that if a user attempts to edit existing published translated content holding said paragraph type prior to the original having a value for that field then the system throws a "Non translatable fields can only be changed when updating the current revision" error.

So far the only workarounds we could think of was to make the field translatable even though it didn't need to be.

Another possibility would be to remove the constraint as suggested here: https://www.drupal.org/project/drupal/issues/2955321#comment-12541730 but we didn't test this.

Your thoughts on this would be greatly appreciated. :)

↧

\Drupal\Core\Field\FieldConfigBase::getDataType() returns 'list', but the data type is actually 'field_config_base'

$
0
0

Problem/Motivation

Surfaced in #3361034, at #3361034-7: Make 'sequence' Typed Data instances return type of 'sequence' instead of 'list'.
\Drupal\Core\Field\FieldConfigBase::getDataType() (introduced in #2283977: Create a new ConfigEntity type for storing bundle-specific customizations of base fields) looks like this:

  public function getDataType() {
    return 'list';
  }

but AFAICT this should be field_config_base!

Why? Because:

config schema types
core.data_types.schema.yml:
field_config_base:
  type: config_entity
  …
core.data_types.schema.yml:
core.base_field_override.*.*.*:
  type: field_config_base
  label: 'Base field bundle override'
field.schema.yml:
field.field.*.*.*:
  type: field_config_base
  label: 'Field'
… which match EXACTLY with:
abstract class FieldConfigBase extends ConfigEntityBase implements FieldConfigInterface { … }
class BaseFieldOverride extends FieldConfigBase { … }
class FieldConfig extends FieldConfigBase implements FieldConfigInterface { … }

Steps to reproduce

N/A

Proposed resolution

  1. Investigate
  2. Tests + fix.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

TBD

↧

After exposing media image's name field and translating it, it gets overwritten by the default field mapping.

$
0
0

Problem/Motivation

After exposing media image's name field and translating it, it gets overwritten by the default field mapping.
(Removing the default field mapping for the Name field, resolves this issue)

Steps to reproduce:

  • (optional) Setup Drupal using Umami installation
  • Exposed the title (Name) of image media.
  • Enabled translation for image media.
  • Add an image and give it a title.
  • Clicked on 'translate', and translate both title and alternative text.
  • The title does not get translated :(

Because of default field mapping of the Name field, it overwrites manual changes.

Translating the image:

After translation it keeps the filename as its Name instead of getting the new translation

Proposed resolution

When name of image is manually entered, it shouldn't get overwritten by field mapping.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

↧

Drastically improve Drupal's default linking experience in text fields

$
0
0

Problem/Motivation

Drupal is a CMS. Content creation is its strength β€” or it should be, at least.

It took until Drupal 8 shipping with CKEditor 4 before content creation had good usability out of the box β€” you'd have had to install https://www.drupal.org/project/wysiwyg plus a lot of manual tweaking before your Drupal 7 site had a good authoring experience.

Drupal 8 and 9 shipped with CKEditor 4 enabled by default. Drupal 9.5 and 10.0 will ship with CKEditor 5 enabled by default. It improves on the authoring experience on many fronts.

One front remains though: even though content creation covers the "C" in CMS, the "M" in CMS is not quite covered yet: Drupal enables you to manage the content through Views, but it makes no effort at all to facilitate linking from one piece of content to another. Even though that's quite literally the essence of the world wide web: web pages (nodes) linked to other web pages (nodes), forming one enormous graph.

Fortunately, there is a Module For That too: https://www.drupal.org/project/linkit. It has matured for twelve years in contrib! 🀩

I think it's high time we bring the essential parts of Linkit into Drupal core: no configuration, just linking:

Proposed resolution

Add the essence of Linkit to Drupal core:

  1. while writing content in CKEditor 5, make it easy to link to other content β€” links and URL fields are completely different beasts because they have
  2. automatically suggest links based on the host entity type (when writing text on a Foo entity, find Foo entities), as well as entity types marked as common reference targets except User (unlikely to link to) and Media (which has its own optimized CKEditor 5 experience already), which means that by default Nodes and Terms will also be searched
  3. require the (newly added) entity_links filter to be enabled, which is conceptually exactly like \Drupal\editor\Plugin\Filter\EditorFileReference (which handles HTML elements with data-entity-type="file" data-entity-uuid="*" src), but this will instead handle HTML elements with data-entity-type="*" data-entity-uuid="*" href) β€” this ensures links are always pointing to the latest URL alias πŸ‘
  4. πŸš€ improve the responsiveness of the autocomplete by applying the same private client-side caching optimization used by \Drupal\ckeditor5\Controller\CKEditor5MediaController::mediaEntityMetadata() and \Drupal\media\Controller\MediaFilterController::preview().
  5. πŸ•΅οΈ for every suggestion: automatically list the author if the entity type has one, automatically list the creation datetime if the entity has one, and list both if the entity type has bothΒ β€” this helps remove the need for some of the configuration surface area

πŸ€” What does https://www.drupal.org/project/linkit have that this merge request does not?

  1. ❌ "substitution" plugins: \Drupal\linkit\SubstitutionInterface (introduced in #2786049: Make entity URL substitutions pluggable to support a wider variety of use cases. and the accompanying data-substitution attribute β€” I don't think it's necessary in 99% of cases β€” if you need this advanced feature, just use contrib Linkit πŸ€“
    βœ… @Berdir and others made the case that we need functionality like this. Solution: introduce link_target handlers for entity types. See #39 for details. CR: https://www.drupal.org/node/3350853.
  2. ❌ "matcher" plugins: \Drupal\linkit\MatcherInterface, \Drupal\linkit\ConfigurableMatcherInterface, etc. β€” just using an entity query to match the entity label is sufficient for ~90% of cases β€” if you need this advanced feature, just use contrib Linkit πŸ€“
    βœ… @Berdir in #18 and #21 articulated why using entity queries is problematic, and why we should use Drupal core's existing EntityReferenceSelection plugins instead! πŸ‘
  3. "linkit profiles" config entities: \Drupal\linkit\Entity\Profileβ€” to be able to choose exactly which entity types to match and how, use tokens to generate customized suggestion descriptions, et cetera. I believe point 5 above covers the 99% case β€” if you need this advanced feature, just use contrib Linkit πŸ€“
  4. (optionally) setting the title attribute on links based on the linked entity's label β€” if you need this advanced feature, just use contrib Linkit πŸ€“ β†’ furthermore, on this issue this was reported to be problematic for accessibility in #51, #55 and #56

🫣 Which contrib modules does this partially or completely replace?
(Usage stats on March 30, 2023.)

  1. https://www.drupal.org/project/linkit (~128,000)
  2. https://www.drupal.org/project/media_entity_download (~7,000)
  3. https://www.drupal.org/project/ckeditor_entity_link (~5,200)
  4. https://www.drupal.org/project/media_entity_file_redirect (~500)
  5. https://www.drupal.org/project/ckeditor_link (~37,200 β€” D7-only)
  6. https://www.drupal.org/project/ckeditor_link_file (~2,100 β€” D7-only)
  7. https://www.drupal.org/project/ckeditor_link_user (~200 β€” D7-only)

And if this functionality is adopted by a site, then arguably most of the functionality in the following modules becomes obsolete:

  1. https://www.drupal.org/project/pathologic (~46,500) β€” in combination with the pre-existing editor_file_reference filter in core
  2. https://www.drupal.org/project/insert (~38,000) β€” in combination with the pre-existing editor_file_reference filter in core

πŸ™ I want to use this but I'm currently using Linkit, how do I switch?
Glad you asked!

https://www.drupal.org/project/linkit used the same data-entity-type and data-entity-uuid that \Drupal\editor\Plugin\Filter\EditorFileReference introduced >8 years ago. It's specifically designed for portability. And it makes the transition from the contrib module to this core feature trivial:

  1. Disable the linkit filter
  2. Enable the entity_links filter

That's it 😊

Remaining tasks

TBD

User interface changes

The CKEditor 5 linking experience becomes vastly better!

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

↧
↧

Remove install of action module from migration tests

$
0
0

Problem/Motivation

There are migration tests that install the action module.

Steps to reproduce

Proposed resolution

Remove actions from the install list.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

↧

D8: Fix handling of database schema updates in update manager workflow

$
0
0

We tried to fix this in D7 at #606190: Fix handling of database schema updates in update manager workflow but ran out of time.

Sadly, the original issue summary there is still basically right for the problem we'd need to fix here. However, I'm opening a new issue since that one is D7-specific, done, and mostly discusses our limited options at the time. In theory, we have more time and options now, so I figured I'd start with a clean slate so we can design and implement something "delightful".

Basically, once you update existing code on your site, there might be DB updates and you might need to run update.php before your site works again. Ideally, update manager would detect this for you, and ideally just do it for you. However, this is complicated for various reasons discussed at length in #606190, in particular, see what I wrote at comments #8 and #32.

So, I don't have high hopes that we're going to do much better in D8 than we have in D7. But, at least if we have an issue open about it there's a non-zero chance for improvement. ;)

↧

Display title setting has wrong schema type

$
0
0

Problem/Motivation

"Display title" is a single checkbox in Block module, therefor is boolean the proper data type in config.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

↧
Viewing all 293641 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>