🇧🇪Belgium @andreasderijcke

Antwerpen / Gent
Account created on 11 July 2015, almost 10 years ago
#

Merge Requests

More

Recent comments

🇧🇪Belgium andreasderijcke Antwerpen / Gent

I confirm that with the MR

  • The view block shows up as facet source on /admin/config/search/facets
  • A facet as exposed filter can be configured (Facets 3.0)
🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke made their first commit to this issue’s fork.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke made their first commit to this issue’s fork.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

After some fiddling, I settled on adding tests against all the available opt-in's except for the next major (doesn't exists at this time) + 'abuse' the 'previous minor' to test against the latest D10.3 version as there is no opt-in variable for the 'LTS' version.

This results in testing against all current D10, current stable D11.1 and D11.x-dev.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke changed the visibility of the branch 3520514-referencefieldextractor-not-checking to active.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke changed the visibility of the branch 3520514-referencefieldextractor-not-checking to hidden.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

We are going to support time field in the custom_field module itself, see Provide a time field Active .
Will be less hassle the other way around.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke changed the visibility of the branch custom_field-3520227-3520227-provide-a-time to hidden.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

The hardcoded field name mistake is fixed.

The nested parent detection and temp storage update/rework to make it all work in paragraphs, I need to let that rest for a bit to get get my head around it.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

I've tested the current status in the project where the need orginated, with Media types for images, remote video,... it all worked as expected.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

So,

  • Removed the code dealing with multiple items within a field item
  • Added the best solution/workaround I could piece together right now, for the add more/remove field items and the form state stored IDs issue
  • Some refactoring for more strict typing
  • Just the getEntityByTargetId() I'm still wondering about if we do need to keep it. It is used, but I do not yet have a clear picture on when
  • Added some ignore patterns of errors we can't fix any time soon (as far as my experience goes) to phpstan.neon but commented out, as those errors only appear from level 6. Getting my code pass level 7 with only unfixable errors ignored, is one my current personal goals.

Feel free to add me as co-maintainer!
Happy to help.

About writing tests, I've made some in the past, but it's steep mountain to climb every time again.
But having specific cases, is a good way to start again.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

At our company, we are having issues again after our hosting moved to more complicated setup of multi webserver per websites and a shared assets directory.

So far, the problem seemed always to be differences in JS dependency, 'claro/ajax' included by this module, to be specific (as we know so far), that should be included or not depending on the user's role (admin versus editor).
An implementation of the gist https://gist.github.com/webflo/67a380250486f8ab2ccacc73efe21406 seemed to have fixed it on a few projects.

However, a colleague reported the problem again on a layout builder route. Have not been able to pinpoint the mismatch in that case and which permission/context it is related to.

The hosting setup seems to be relevant in some way, as locally, we cannot reproduce this.
In the few occurrences that I managed to debug a bit, what seems odd is that both admin and editor got the same JS inclusions in cached responses, which are correct for one user but not there other. I'd expect these responses to be different (dynamic page cache) for these users, containing the proper JS inclusions for their role.
No clue yet if this is related to this or just a consequence of something else interfering or wrong in the base setup we use.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

So, fixed other issue cause by the '$row_id' from the original that is replace here with the delta.
After some playing around with removing, replacing of a selection within a field item, things seems to work as expected.

Where we still do have issues, is when you start removing and adding new field items, you will see the new field item already prefilled with the selection previously stored for that delta.

But, before trying to fix this, I think it might be best to simplify all the code related to determining and storing the selection, as we always will have either a single item (or none) per delta, so we can get rid of the all array_map usages, some loops etc (+ also apply more strict typing where possible etc).
Once done, it might be easier to figure out how to deal with the remaining issues.

What is your take on this?

I was using Gin. I see what you mean now after switching to Claro which btw is a much clunkier UI with the buttons stacking like that.

Yea, that is also an issue on the original widget in Claro.
To make sure I understood you correctly, you're going to work on patch for Gin support for entity_browser module, right?

🇧🇪Belgium andreasderijcke Antwerpen / Gent

I'll leave it to you to refine further but its in a pretty good functional state at least for now.

Thank you, that was of much help!

I made the 'remove' button work, found an issue with the 'add another item' on the field itself + cleanup some code.

It is very likely there is more code we can strip, and some specific situations we have to handle properly or different compared to the original.

I realized for some reason the replace and edit icon are the same. When you disable the edit but enable the replace, the pencil icon still shows up and the replace functionality works on click. I don't know if we have something wrong in our implementation or if thats just the way it works... which would be odd

That sounds like a (admin) theme compatibility issue. Which theme are you using?
How does it look on a default entity reference field with the original entity browser widget?

Using Claro, there are no icons and the labels are correct.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

The isApplicable() should maybe check if there are actually any entity_browser entities and that select field should be required

At the moment, I favour to not do that, so you'll be able to see the widget and its options and be triggered to configure some entity browsers if you don't have any. Otherwise, you might be wondering why the widget isn't shown as an option.

I noticed also an entity_browser can have an upload widget but it would be irrelevant if the entity_reference target_type is not one of file||image

As far as I know/understand things, upload is handled by/in the entity browser modal and this widget is just to expect the entity ID in return.

We don't need to check for the field_type otherwise in isApplicable() as its already defined in the plugin attributes.

Ah, great!

Related, entity_browser defines an adjusted widget for file and image. We might want to follow that, and keep this one to just 'entity_reference' (as you added file and image types)?

... i'm sure theres some settings that are irrelevant since we can only ever have 1 selection.

Yes, very likely.

As soon as the basic usage flow falls into place, I expect it will be more clear what pieces of can be scrapped.
For now, I'm keeping things I don't understand/have not checked or adjusted yet, for easier comparison with the original.

Related (again): I've heard there is some discussion going on about dropping support for submodules in contrib modules. (A necessity for project browser, also something related to composer/packaging issues, ...).
So perhaps, since this quite a complicated widget, it might be opportune to not merge it in the main module but release it separate, which should also make it easier to develop the main module without being 'dragged down' by complicated extensions like this and manage their dependencies.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

It seems I was using 1.x branch of entity_browser as reference, so synced with the 2.13 release.

Managed to get selection (working with fixed cardinality of 1) saved and loaded on reload of the node edit form. But the 'edit', 'replace', 'remove' buttons of the entity browser are not shown properly, must be conflict of their (wrapper) markup with the parent widget wrappers.
That is on the list for tomorrow, as once fixed, it will be easier to fix and test the remaining gaps.

I will continue to work on this the next days during the Drupal Dev Days in Belgium.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

It's a still work in progress!

Currently struggling with getting the selection in the entity browser stored and the entities rendered in the widgets.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke changed the visibility of the branch 3519258-support-entity-browser to hidden.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

Since this is a formatter, we can't validate on input, which I forgot in the issue description.
Therefor, proposed in the MR is:

  • Some regex to strip characters the wa.me URL can't handle and massage the value towards the expected format.
  • Added composer.json to suggest installing telephone_validation for actual input validation

These two combined still allow for a zero between the country code and actual number, but that does not seem to be a problem for Whatsapp.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

After reviewing and comparing the pipeline jobs and results with other modules, it turns out that

  • OPT_IN_TEST_PREVIOUS_MAJOR
  • OPT_IN_TEST_NEXT_MAJOR

are only useful if the module has unit tests. Otherwise, these will just trigger a composer install with that major version, which will succeed anyway if there is no composer requirement restriction for core.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

Added a first proposal for views filter for TimeRange field, as extend on the core numeric filter:

  • Scrapped the regex operations, as they make no sense with time input.
  • The 'is empty' operation does not work if there is no field record at all, see comment in code.
  • Definitely needs more work and testing.

In my case it's a view of nodes with paragraph having the timerange field.

While writing this down, I realise I've been confusing the 'from' and 'to' input of the between filters with the 'from' and 'to' from the TimeRange field, and the filter would just as well work on the regular Time field.
If that's true, then rename of the filter class is recommended.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke changed the visibility of the branch 3029652-add-functionality-to to active.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke changed the visibility of the branch 3029652-add-functionality-to to hidden.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke changed the visibility of the branch 3029652-add-functionality-to to hidden.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

I've added the file with following variables overwritten:

  • SKIP_ESLINT: as the module does not have any JS.
  • OPT_IN_TEST_PREVIOUS_MAJOR: to test against D10 too (at this moment)
  • OPT_IN_TEST_NEXT_MAJOR: to test against D12 as soon as the branch is started.

Also added the .cspell-project-words.txt file using the artifacts from the CSpell run.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

I cannot reproduce the case, but the additional check makes sense and should not break anything, in contrary.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke made their first commit to this issue’s fork.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

That patch makes indeed sense.

I'm just wondering if there are other situations where the current (content) language will not match entity (translation) being edited or created.

In my language (detection) setup, the $entity->getTranslation() is returning the default translation of the entity because of the fallback logic in \Drupal\Core\Entity\EntityRepository::getTranslationFromContext().
Any module affecting this fallback logic, could indeed lead to different result.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

@swentel: What's the context of your case?
Inline entity form perhaps?

🇧🇪Belgium andreasderijcke Antwerpen / Gent

Ah, sure. I guess "if interface and content language differ" is indeed to vague.

Something like this:

(The "Selected language" is identical for both interface and content, as-in they share the value, set to default site language).

Point is to get to active language for interface and content to differ, one way or another.
That this can happen is often overlooked, both in core and contrib. Core does not always separate interface and content properly either, many issue about that.

Just imagine, you have editors with different native languages, and they each one wants to have the interface in their own preferred language (hence the "Account administration pages" enabled for interface) but they all managed content in all available languages.

So, in my specific case, I tried to edit an existing node with custom field with only NL translation (source) while having the interface forced to EN.
In that case, the code (pre) patch would use EN as default language to load the entity in for access checking, while it might not exist (yet) in that language. The content language does return NL in that case, since we're indeed editing the entity in that language.

PS: While trying to post the commit, the issue was already set to fixed. But submitting this anyway for future reference.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

I've expanded the patch, as the previous version was did non suffice on D10.4 when the widget is hidden on entity translation forms due to the field being not translatable.

Core field constraints on the field are still fired, thus blocking creation of the entity translation. In the process, access check on the field returns 'allowed' causing the field to be taken into account for validation, even though it should not.

Have not found a solution to prevent this from happening, but discovered along the way that when the widget is hidden, the field submission values contain the options and current value, which cause the field constraint validation to fail.
By massaging the field submission values, or cleaning, this can be prevented and translation submission proceed.

This solution is added to the MR, including note that it is only a workaround until a better/real fix can be found.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

Different patch as MR, because I think the base check can be simplified.

In addition, the is_numeric check should not be necessary according to the return type of getDomainId(), so either the check is obsolete, or the function doc is incomplete.
As I don't have the correct answer, have flagged it as a todo.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

Thanks for reporting and the proposed solution.

I will start a new minor version for D11, as many modules do. At the time, I didn't realise this change in ConfigFormBase was this impactful.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke changed the visibility of the branch 3501197-using-error-level to active.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke changed the visibility of the branch 3501197-using-error-level to hidden.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke changed the visibility of the branch 3501197-using-error-level to hidden.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

Tweak added. Didn't think of it, even having used it before.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke changed the visibility of the branch 3508066-error-call-to to hidden.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

I made the checks a bit more specific, as it didn't suffice for Layout Builder. The getValue() was still reached.

It would be even better if we could check the object class instead of presence of the getValue() method, but I don't know which one is expected.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

andreasderijcke made their first commit to this issue’s fork.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

@stephencamilo The require-dev dependencies are only for development of the module and running tests that (might) test support and cooperation with those modules.
Those modules are not mandatory for this module to work, so it is correct that they are not listed in the info.yml file. As far as i can tell, both the info.yml and composer.json file are fine as they are.

Which features are you using that are causing a problem?

🇧🇪Belgium andreasderijcke Antwerpen / Gent

I want to raise this to critical, because this problem can make a website completely inaccessible (access denied on all routes)

🇧🇪Belgium andreasderijcke Antwerpen / Gent

AccountInterface instance can have no ID in valid use cases, even though the AccountInterface does not say so (but should).

A good example is the Search API RenderedItem processor: a User(Session) is created on the fly to render and index entities for that user's role. This user is never saved, thus has no ID.
See https://git.drupalcode.org/project/search_api/-/blob/8.x-1.x/src/Plugin/...

Should the AccountInterface get updated to reflect the fact that the ID can be NULL, it still needs to be handled here.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

No, was just a test to see if changing the issue credits assignment would stick, as a thank you for the work done.

🇧🇪Belgium andreasderijcke Antwerpen / Gent

Smart Date is also conflicting.
One way to 'fix' this, is by increasing the weight of the module in core.extensions.yml, not without risk however.

Production build 0.71.5 2024