Account created on 23 January 2007, over 18 years ago
#

Merge Requests

More

Recent comments

🇬🇧United Kingdom joachim

The UI texts aren't clear when the host and target entity type are the same, as with taxonomy parent field:

> “Taxonomy term using parent” — “Relate each Taxonomy term with a parent set to the taxonomy term.

Needs a rewrite.

🇬🇧United Kingdom joachim

In the meantime, I've converted the most recent patch to an MR, rebased on 11.x.

🇬🇧United Kingdom joachim

- We only need class-level docblock
- getWeight() and setWeight() are not needed. The list builder uses the get() and set() method which all config entities have.

🇬🇧United Kingdom joachim

Agreed, the BC break needs fixing, as clearly other code is calling this.

(We probably need our BC policy to get real and state that generic entity handlers are public API, because everyone already treats them as such.)

> - 2) Looking over the code, my gut feeling is that adding this arg makes complex code even more complex and should be done differently.

I'm not sure how!

The nature of a reverse entity reference field is that we need to add data to ANOTHER table from the one for the current field -- it needs to go on the table for the reference field's target entity.

And the way the methods in this class work is that there is a helper method for each field type.

Therefore, the field type helper method, processViewsDataForEntityReference() in this case, needs access to the whole of the Views data, not just for the field's table.

🇬🇧United Kingdom joachim

> using the AI only for ideas and boilerplate code

Which is probably more time-consuming that writing it yourself -- how many developers actually enjoy cleaning up someone else's badly-written code, instead of writing fresh? And all it does is legitimises the hype and marketing around AI.

🇬🇧United Kingdom joachim

Until this gets committed, copying the class into a module and hardcoding a few things is a viable option :D

https://git.drupalcode.org/project/computed_field/-/blob/4.0.x/src/Eleme...

🇬🇧United Kingdom joachim

Looks good to me, working well with Entity Share!

🇬🇧United Kingdom joachim

I'm not able to reproduce this.

I've got paragraphs that I've pulled in from a node, and the parent_id value is different on the source and the destination.

I assume that Paragraphs module is overwriting this when the paragraph entity is saved?

🇬🇧United Kingdom joachim

Fixed on both branches, as our 3 branch has 10.3 as a minimum.

Thanks everyone!

🇬🇧United Kingdom joachim

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

🇬🇧United Kingdom joachim

This is RTBC but I don't see an MR or a patch here.

🇬🇧United Kingdom joachim

Committed to the 4 and 3 branches.

🇬🇧United Kingdom joachim

This needs comments to explain what's going on.

We already have:

    $data_langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED;
    if ($langcode_public_name && !empty($entity_data['attributes'][$langcode_public_name])) {
      $data_langcode = $entity_data['attributes'][$langcode_public_name];
    }

I don't understand how the patch code interacts with that code.

Also, could this be a MR please?

🇬🇧United Kingdom joachim

> is like 20 years ago you say people can not write with mobile phone on our community.

That is a completely incorrect comparison. A mobile phone is a device which you use to write the code. It's still your code, your intent.
The LLM-written code has only a minimal intent, minimal decisions.

🇬🇧United Kingdom joachim

We can't add return types to the Views style plugin, because core hasn't yet signalled that it will add them. We have to wait for that.

And we can't add return types to our own interface, because it's part of our API. We have to add them with BC support.

🇬🇧United Kingdom joachim

Tagging as novice as the fixes look pretty simple.

🇬🇧United Kingdom joachim

Got this working, will push a MR tomorrow.

🇬🇧United Kingdom joachim

Oh yeah, good point!

I did that with the PathAliasProcessor too.

But TBH it's pretty messy -- plugins shouldn't be storing state data like this.

Also, the 'prepare_importable_entity_data' stage is the same one in which DefaultDataProcessor removes the remote IDs, so it means that the RedirectProcessor **must** run before it -- that's pretty brittle.

🇬🇧United Kingdom joachim

Yup, 'allows' works now, so updating the IS.

> I don't see a compelling reason to change it at this point, perhaps the help text could be made clearer.

The help text is completely wrong!

I would say that this is obsolete because of Create Javascript library for searching rendered lists on the client. Active but that has been stalled for a very long time.

🇬🇧United Kingdom joachim

I've hit a bit of a problem with this, as a redirect processor needs the remote entity ID in order to assemble a canonical URI for the entity on the server, which it can then use to query for the relevant redirect entities.

However, by the time we get to processEntity() in the processor, DefaultDataProcessor::prepareImportableEntityData() has already removed the "drupal_internal__id" key from the attributes array, so we've lost the remote entity ID!

Could a copy of the original incoming JSON data be set in the JSON array, say at '_attributes_original'?

🇬🇧United Kingdom joachim

joachim created an issue.

🇬🇧United Kingdom joachim

Yup, I just tried it, and you don't need a special field plugin. I don't understand what your MR does -- why are you selecting computed field plugins, which aren't even necessarily going to be attached to the entities shown in the view?

All you need for a config computed field is this:

  /**
   * Implements hook_views_data_alter().
   */
  #[Hook('views_data_alter')]
  public function viewsDataAlter(array &$data) {
    // My computed field has the field machine name 'computed_computed_bundle_field'. This key is arbitrary, but using the field name keeps it tidy.
    $data['node_field_data']['computed_computed_bundle_field'] = [
      'title' => t('computed_computed_bundle_field field'),
      'help' => t('Somecomputed_computed_bundle_fielder'),

      'field' => [
        // This is the field plugin to use for ANY entity field.
        'id' => 'field',
        // I can't remember which of these is needed or if both are.
        'entity field' => 'computed_computed_bundle_field',
        'field_name' => 'computed_computed_bundle_field',
      ],
    ];
  }
🇬🇧United Kingdom joachim

I don't understand this MR.

IIRC the problem is with declaring the fields to view. Why is a separate handler needed?

🇬🇧United Kingdom joachim

I was going by the principle that bugs get fixed first on the most advanced branch, and then back-ported :)

🇬🇧United Kingdom joachim

I think this is one of a big set of issues I created from a long list of classes, and I must have messed up, as the title mentions ContentTranslationContextualLinksTest but the issue text mentions ContactLanguageTest.

However, in either case, this is outdated.

- ContentTranslationContextualLinksTest was fixed in 📌 Use the API to set up languages in tests that are not specifically testing the language form Fixed .
- ContactLanguageTest in 📌 ContactLanguageTest should use API to set up language Fixed

🇬🇧United Kingdom joachim

That's a good start, but we can't just remove constants, because people will be using them.

We have to deprecate them: see https://www.drupal.org/about/core/policies/core-change-policies/how-to-d...

Removal will come in a future version.

While we're at it, I think that the wording from node is clearer:

> * Denotes that the [node] is not published.

🇬🇧United Kingdom joachim

I'm not sure where you mean I should put 'fixed', but I can't change the classes on that element -- they're coming from the template in Gin.

I've narrowed the problem down to these two overflow properties:

.gin-table-scroll-wrapper {
  clear: both;
  overflow-x: auto;  <--
  overflow-y: hidden; <--
🇬🇧United Kingdom joachim

It's something done by the classes

> gin-table-scroll-wrapper gin-horizontal-scroll-shadow syncscroll

on the DIV around the table.

If I remove those classes in the browser developer tools, the problem is fixed.

🇬🇧United Kingdom joachim

The Module Builder team is me. I built that UI.

> as we're hesitant to add any further custom code for modules at this point to Gin.

I'm not asking for special treatment. You're presumably doing something weird with CSS which is breaking things.

🇬🇧United Kingdom joachim

This is not a Module Builder bug -- as you can see in the screenshot, it works fine in Claro.

🇬🇧United Kingdom joachim

I thought I understood what the different authorization plugins did, but Use user.login.http instead of user.login Active has got me totally confused again.

I thought that the basic_auth plugin relied on the server accepting the credentials in the HTTP header -- because this message shows when you select it in the UI:

> With the Basic Auth authorization method you need to ensure that the HTTP Basic Authentication module is enabled on the server website.

But then why does it also do this:

    $http_client->post($login_path, [
      'form_params' => [
        'name' => $credentials['username'],
        'pass' => $credentials['password'],
        'form_id' => 'user_login_form',
      ],
🇬🇧United Kingdom joachim

> - Update the basic auth plugin

I thought that the basic_auth plugin relied on the server accepting the credentials in the HTTP header -- because this message shows when you select it in the UI:

> With the Basic Auth authorization method you need to ensure that the HTTP Basic Authentication module is enabled on the server website.

Why would it also go to the login form?

🇬🇧United Kingdom joachim

I feel this might clash a bit with add long table name abbreviation to Database API Active .

Is the MR here just rejecting names which are too long? Could it leave space for that issue to handle them?

🇬🇧United Kingdom joachim

I'm going to call this fixed, as now we're on to specific tests being broken -- these are best fixed in individual issues.

🇬🇧United Kingdom joachim

Making the title clearer.

Confirming this fixes the error for me.

🇬🇧United Kingdom joachim

Pushed a branch on 3 too, for anyone wanting the patch.

🇬🇧United Kingdom joachim

On the 3 branch, this parameter needs to be made optional so to not break BC with any plugins.

However, I'm going to be closing the 3 branch soon, so this doesn't matter unless anyone wants this on 3 and wants to update the patch.

I'll commit this once the 4 branch CI is passing!

🇬🇧United Kingdom joachim

Thanks for the patch.

Needs a bit of work -- also, could you use a MR rather than uploading patches please?

  1. +++ b/modules/entity_share_client/src/Plugin/EntityShareClient/Processor/ModerationStateProcessor.php
    @@ -0,0 +1,64 @@
    + *   label = @Translation("Moderation State Processor"),
    

    Sentence case rather than title case.

  2. +++ b/modules/entity_share_client/src/Plugin/EntityShareClient/Processor/ModerationStateProcessor.php
    @@ -0,0 +1,64 @@
    +{
    

    Code formatting.

  3. +++ b/modules/entity_share_client/src/Plugin/EntityShareClient/Processor/ModerationStateProcessor.php
    @@ -0,0 +1,64 @@
    +    if ($processed_entity->hasField('moderation_state')) {
    

    Somewhat a personal preference, but I think it's easier to read with the return early pattern.

🇬🇧United Kingdom joachim

Looks good so far, but the import_config entity type needs this removing too.

Needs fixing on both active branches.

🇬🇧United Kingdom joachim

There's no need to file this twice -- the same issue can do both branches.

🇬🇧United Kingdom joachim

Fixed on both the 3 and 4 branches.

🇬🇧United Kingdom joachim

I've tested the current MR with field data in all forms:

- a path alias to a node: /mynode
- a system path to a node: /node/1
- using the lookup to store the entity

In all cases, the item is skipped when the user doesn't have access, so that's working well!

I don't know about the caching side of things though -- see my comment above.

🇬🇧United Kingdom joachim

Also, outputting broken internal links really looks like a bug to me -- one of the duplicate issues filed it as such too.

🇬🇧United Kingdom joachim

Link field > Access to internal links is not checked on display. Active 's MR is pretty basic.

#2968609: Link fields do not check access for entity refs 's MR has a lot of stuff that isn't here.

1. More work on the URL, e.g.:

      if ($url->isRouted() && preg_match('/^entity\.(\w+)\.canonical$/', $url->getRouteName(), $matches)) {
        // Check access to the canonical entity route.
        $link_entity_type = $matches[1];
        if (!empty($url->getRouteParameters()[$link_entity_type])) 

Should we be doing that here?

2. More stuff on caching that I've not looked at in depth

3. A function test (though it could really be a kernel test)

🇬🇧United Kingdom joachim

I am marking the following as duplicates:

- Only display internal links to content the user has access to view Closed: duplicate -- older, but has no code
- Link field > Access to internal links is not checked on display. Active -- more recent, has a MR
- #2968609: Link fields do not check access for entity refs -- older, has a MR, but the MR has not been updated in longer

Code from those issues with MRs should be compared with what is here, in case there are ideas that should be integrated into the MR here.

Participants in all those issues should have credit added here.

Production build 0.71.5 2024