Milan
Account created on 11 June 2013, about 12 years ago
#

Merge Requests

Recent comments

🇮🇹Italy kopeboy Milan

Patch #112 applied cleanly to Drupal 10.5 too but it doesn't work for creating Users.

Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null: INSERT INTO "users_field_data" ("uid", "langcode", "preferred_langcode", "preferred_admin_langcode", "name", "pass", "mail", "timezone", "status", "created", "changed", "access", "login", "init", "default_langcode") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14); Array ( [:db_insert_placeholder_0] => 7 [:db_insert_placeholder_1] => it [:db_insert_placeholder_2] => it [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => Europe/Rome [:db_insert_placeholder_8] => 0 [:db_insert_placeholder_9] => 1751017446 [:db_insert_placeholder_10] => 1751017446 [:db_insert_placeholder_11] => 0 [:db_insert_placeholder_12] => 0 [:db_insert_placeholder_13] => [:db_insert_placeholder_14] => 1 ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

🇮🇹Italy kopeboy Milan

Here a more robust alternative, that includes both a field widget "Select list of alternative revisions" (that no longer filters for the current user as author by default, but allows that as the widget configuration), and a field formatter "Configurable label + diff link", that allows configuring a label with substitutions, provides a button link to view the revision and, if diff module is enabled, another button to compare the selected revision with the current (default) revision.

🇮🇹Italy kopeboy Milan

I couldn't make a Views of revisions work as a reference method (it seems we need to change core?), so I made this field widget as a temporary workaround that provides an options select list of revisions.

It filters for the allowed bundle from the entity_reference_revisions field's settings, revision author (uid) = current user, it removes current revisions, and displays max 10 results, sorted descending by creation timestamp. It even allows customizing the option text in the widget settings with @title, @date, @log substitutions (html tags will be stripped from the revision log message if present).

Put it in your custom module or directly in entity_reference_revisions (fix the namespace at the top of the file accordingly), at /src/Plugin/Field/FieldWidget/CurrentUserRevisionSelectWidget.php and flush caches.

I hope it helps and can even be included as a sub module.

🇮🇹Italy kopeboy Milan

Even if you don't want to use Views for the selection method, I don't see revisions appear with the default autocomplete either!

🇮🇹Italy kopeboy Milan

Oh I didn't see the mention of Version Override on the module page, thanks.

So for everyone: with Drupal 10.5 nothing needs to be done, links to bookmarks (with anchors) work by just enabling ckeditor5_plugin_pack_bookmark and adding the bookmark to the text format, even without enabling ckeditor5_premium_features_version_override module. Great.

🇮🇹Italy kopeboy Milan

Even if I don't have a real URL to test now, this seems working. Thanks!

🇮🇹Italy kopeboy Milan

I also cannot update. All my modules are compatible (scanned with upgrade_status). I'm on DDEV with Drupal 10.5

ddev composer update "drupal/core-*" --with-all-dependencies returns: Nothing to install, update or remove

ddev composer require drupal/core-recommended:11.2.0 drupal/core-composer-scaffold:11.2.0 drupal/core-project-message:11.2.0 --update-with-all-dependencies returns drupal/core-recommended 11.2.0 requires symfony/console ~v7.3.0 -> found symfony/console[v7.3.0-BETA1, ..., 7.3.x-dev] but these were not loaded, likely because it conflicts with another require., but ddev composer why-not drupal/core 11.2.0 returns nonsense, like

drupal/core 11.2.0 requires symfony/console (^7.3)                                     
drupal/recommended-project - does not require symfony/console (but v6.4.22 is installed)

and similarly composer update "drupal/core:11.2.0" --dry-run only cites problems contrib modules which actually support ^11 🤷🏻‍♂️

Regarding #22: how can we check if we

may have converted drupal/core-recommended and others to dev dependencies there by answering yes to “Do you want to re-run the command with --dev?”

I don't remember that; I installed with DDEV Quickstart (leading to 10.4) and used suggested composer commands on d.org to update to each Drupal 10 release until 10.5

Attaching my composer.json as txt (since we can't upload .json files).

🇮🇹Italy kopeboy Milan

Proof of Concept: add a formatter like

namespace Drupal\field_description_tooltip\Plugin\Field\FieldFormatter;

use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * Plugin implementation of the 'description_tooltip_label' formatter.
 *
 * @FieldFormatter(
 *   id = "description_tooltip_label",
 *   label = @Translation("With Description Tooltip on Label"),
 *   field_types = {
 *     "string", "text", "integer", "entity_reference", "boolean", "list_string"
 *     // Add more types or use BaseFieldDefinition if general.
 *   }
 * )
 */
class DescriptionTooltipLabelFormatter extends FormatterBase {

  /**
   * {@inheritdoc}
   */
  public function viewElements(FieldItemListInterface $items, $langcode) {
  $elements = [];

  $description = $this->getFieldDefinition()->getDescription();
  $label = $this->getFieldDefinition()->getLabel();

  // Render all field values together.
  $values = [];
  foreach ($items as $item) {
    $values[] = $item->view($langcode);
  }

  $elements[] = [
    '#type' => 'inline_template',
    '#template' => '
      <div class="field-tooltip">
        <div class="field-label" title="{{ description }}"><strong>{{ label }}</strong>:</div>
        <div class="field-items">
          {% for value in values %}
            <div class="field-item">{{ value }}</div>
          {% endfor %}
        </div>
      </div>',
    '#context' => [
      'description' => $description,
      'label' => $label,
      'values' => $values,
    ],
  ];

  return $elements;
}
🇮🇹Italy kopeboy Milan

Actually this issue can be just about setting a correct path, which can be public://tmp or temporary:// (they should work after fixing the other related issue). To use private:// you must first set the private file path in your settings.php.

Still TODO: improve the help text of the Upload location field

I'm not an expert dev so I'll leave it to others.
(Sorry for the noise).

🇮🇹Italy kopeboy Milan

#18 solves the issue.

For newbies: there are some requirements though before being able to use those commands correctly (specifically requiring cweagans/composer-patches, otherwise the composer update won't do anything).

🇮🇹Italy kopeboy Milan

It's weird because the first time I created a bulk upload configuration (with a simple string like my_folder), I could upload in bulk, then I re-created it or created a new one and I started getting that error during bulk upload.

Using temporary:// revealed another error (with any Form mode selected in the configuration):

No media files have been provided.

but the images are below, unselected, and even if I select them and try to submit, I get the error again.

If in the configuration I leave the Upload location field empty (please note it's not required), the error I get when uploading the files is

The file could not be uploaded.

On a local (DDEV) Drupal 10.4.7, without Dropzone JS submodule.

🇮🇹Italy kopeboy Milan

Safari now supports them..

🇮🇹Italy kopeboy Milan

This is not a Drupal core feature but provided by the contrib module conditional_fields, so you should check/ask in its issue queue.

🇮🇹Italy kopeboy Milan

I see double title too, both on Claro and Olivero themes. You probably have some custom view mode @aditi-saraf

🇮🇹Italy kopeboy Milan

..it now shows: Never change the default language after adding content, otherwise things will break!

🇮🇹Italy kopeboy Milan

Now the question is: How to build a Drupal app with git nowadays?!

🇮🇹Italy kopeboy Milan

a recipe could supply (or dynamically create) an ECA model to reapply itself any time a particular condition, or set of conditions, is fulfilled

🤯 🙌🏻

🇮🇹Italy kopeboy Milan

I can't find a way to patch this module if it cannot be installed. The issue is marked for 8.x-1.3 but isn't the MR on 8.x-1.x?

Can we have a new release please?

🇮🇹Italy kopeboy Milan

I noticed this module could be relevant: ai_integration_eca

🇮🇹Italy kopeboy Milan

Yes, this would be great! The real automation and assistant capability come from being able to chain actions, and we already have a framework in Drupal, not only to define and run them, but also to visualize & customize their flow without code with ECA module.

I would say a natural language way of describing actions is with a [subject], [verb], [object], where normally the subject is the current user, the verb extracted from what the user asked the chat bot and used to find the closest synonymous from whitelisted action_id(s) and ECA models, and the object the closest [entity_type_id] or the [entity] provided by a token.

We could even define config entities that reference existing actions to provide metadata, ie. text suggestions on how to use the action, description of what it does, the synonyms above (for ECA models we could directly use their documentation field), and the entity types it can work on (for ECA models, ie. more abstract or complex actions, these could be custom inputs and outputs), to produce a rich list of actions that the LLM can pick from, trimmed down to only the ones that work on similar prompted [object]s.

🇮🇹Italy kopeboy Milan

@megachriz I think you are seeing Tamper only as part of Feeds, while it is a standalone module. I, for example, was trying to use it as a dependency to eca_tamper, to manipulate strings with actions inside my ECA models, and the hash plugin wasn't working.

If I change this:

public function tamper($data, TamperableItemInterface $item = NULL) {

    if (empty($data) || $this->getSetting(self::SETTING_OVERRIDE)) {
      $values = $item->getSource();
      return md5(serialize($values));
    }

    return $data;
  }

to this, it will work fine as an ECA action:

  public function tamper($data, TamperableItemInterface $item = NULL) {
    return md5(serialize($data));
  }

Now take a common (I think) implementation (like my case), where you need to hash an authenticated API request: it would be nice to use the much more popular & useful hash_hmac PHP function (but that requires a key input) instead of deprecated md5, something like this (even nicer would be to integrate with the key module to use secret keys defined there):

<?php

namespace Drupal\tamper\Plugin\Tamper;

use Drupal\Core\Form\FormStateInterface;
use Drupal\tamper\Exception\TamperException;
use Drupal\tamper\TamperableItemInterface;
use Drupal\tamper\TamperBase;

/**
 * Plugin implementation of the hash plugin.
 *
 * @Tamper(
 *   id = "hash",
 *   label = @Translation("Hash"),
 *   description = @Translation("Makes the value a hash of the values of item being tampered."),
 *   category = "Other"
 * )
 */
class Hash extends TamperBase {

  const HMAC_ALGO = 'sha256';
  const KEY = '';

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    $config = parent::defaultConfiguration();
    $config[self::HMAC_ALGO] = 'sha256';
    $config[self::KEY] = '';
    return $config;
  }

  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form[self::HMAC_ALGO] = [
      '#type' => 'select',
      '#options' => hash_hmac_algos(),
      '#title' => $this->t('Hashing algorithm'),
      '#description' => $this->t('Select the hashing algorithm to use (defaults to sha256).'),
      '#default_value' => $this->getSetting(self::HMAC_ALGO),
    ];
    $form[self::KEY] = [
      '#type' => 'string',
      '#title' => $this->t('Hashing secret key'),
      '#description' => $this->t('The secret key used to hash the value.'),
      '#default_value' => $this->getSetting(self::KEY),
    ];
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
    parent::submitConfigurationForm($form, $form_state);
    $this->setConfiguration([
      self::HMAC_ALGO => $form_state->getValue(self::HMAC_ALGO),
      self::KEY => $form_state->getValue(self::KEY),
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function tamper($data, TamperableItemInterface $item = NULL) {
    return hash_hmac(self::HMAC_ALGO, serialize($data), self::KEY);
  }

}
🇮🇹Italy kopeboy Milan

Describe how to override the template files provided by the module with custom ones provided by my theme or custom module. Simply calling the custom template files like those supplied by the module won't work (ie. override them) because they don't follow the standard Drupal template naming convention.

🇮🇹Italy kopeboy Milan

Can you share that code please? 🙏🏻

🇮🇹Italy kopeboy Milan

I think the most important would be link fields:

  1. having the option to show the link under the code would be great, so thatusers with the scanning device can scan it, but others (say mobile phone users, when showing a QR code) may directly click the link to reach the same destination;
  2. having the option to use custom protocols (for deep links) would be great too, ie. not only https:/ but myapp:/ or any other (whitelisted from settings maybe) open source protocol
🇮🇹Italy kopeboy Milan

I even tried disabling verification on each link decorator setting, without success, but I guess the field formatter setting should override the setting at each decorator, right?

🇮🇹Italy kopeboy Milan

I would expect the problem to go away after disabling the verification from the field formatter, but on every link field save the page takes ages to load and will again show the errors. Why is that? I even tried removing the verification checkbox on the modules settings for each social network, but the problem stayed. Should I open another issue?

🇮🇹Italy kopeboy Milan

I guess being able to reset passkeys is necessary for a release?

🇮🇹Italy kopeboy Milan

I tried with a different variation of ECA model as well, ie. I replaced the action to set the order token manually with one that loads the entity by Type & ID (selection Order entity type), but nothing changed.

Maybe we can take inspiration from this module: direct_checkout_by_url

🇮🇹Italy kopeboy Milan

This is the ECA model with which I'm trying. I just set up a Commerce store and a single product with 1 variation with sku "VAR1".

Nothing happens when I run the custom ECA event from the command line..

🇮🇹Italy kopeboy Milan

Can you provide a working example ECA model? Cause I couldn't get this to work and I'm not receiving any error messages

🇮🇹Italy kopeboy Milan

Last commit seems wrong: both
"drupal/draggableviews": "^3.0", and
"drupal/form_mode_control": "^3.0", don't seem to exist.

Shouldn't they both stay at ^2.1?

🇮🇹Italy kopeboy Milan

Is using a Service worker with Drupal something a curious Site builder can do though?

🇮🇹Italy kopeboy Milan

Does this mean that recipes can now be applied successfully on the command line, even if the configuration they include isn't actually applied to the site? How would a site builder identify pre-existing configuration issues and distinguish them from problems with the recipe itself?

🇮🇹Italy kopeboy Milan

FYI I noticed that the latest version of this module (v4, now stable) doesn't have this issue.

🇮🇹Italy kopeboy Milan

I just installed this module (version 8.x-7.1) on Drupal 10.3.6 and I can't reproduce this. I can create new content with the faq field empty and no error nor any field artifact will show up in the saved content.

Are you sure your field doesn't have the "Required field" option enabled in its field settings, nor the "Required Field Question" and "Required Field Answer" checkboxes in the field formatter options (at Manage Form Display)?

🇮🇹Italy kopeboy Milan

@sebastian-hagens: I know, you can see it even in my screenshot..

I had the subscriptions and I had run cron, but no DANSE events nor notifications were being created & sent.

🇮🇹Italy kopeboy Milan

I don't think you need this with CKEditor 5, as it supports inline code out-of-the-box (without adding any plugin/button/configuration): install a fresh Drupal 10 site and type `text` (the backtick) in any CKEditor textarea to see the text wrapped in <code>.

🇮🇹Italy kopeboy Milan

Looks nicer, but the old (horizontal) admin_toolbar is faster. I would like an horizontal option.

🇮🇹Italy kopeboy Milan

Since we are here (😅😇).. I noticed that the relevant CSS is not applied to the front-end theme, ie. when there is no CKEditor active on the page..

so shouldn't we remove the .ck-content class prefix from this CSS below, to make it look good out-of-the-box everywhere?

.ck-content .todo-list .todo-list__label .todo-list__label__description {
    vertical-align: middle;
}
.ck-content .todo-list {
    list-style: none;
}

The margins top & bottom instead are irrelevant as a frontend theme will always have them already on lists (so I wouldn't touch all other CSS), but the margin-left is needed and missing from the frontend (see below), so I would add margin-left: 1ch; to the first declaration above (without the .ck-content class prefix).

AS IS while editing (with Claro default theme):

AS IS while viewing (with Olivero default theme):

TO BE while viewing (with Olivero default theme and the edits I described):

🇮🇹Italy kopeboy Milan

Sorry, I didn't even now what "inject services in the class constructor" meant 😅😇, so I asked ChatGPT and tried to provide a new MR accordingly.

🇮🇹Italy kopeboy Milan

That worked! I didn't know about the configure key in the module.info.yml file, thanks!

🇮🇹Italy kopeboy Milan

I'm getting a warning by phpcs: Undefined method 'getEntity' (with and without the patch).

🇮🇹Italy kopeboy Milan

A standard composer require won't work even with those linked projects.. Seeing from their README there are many steps to do 😅 And if they are correct, maybe they should be added to this module's README?

🇮🇹Italy kopeboy Milan

#2: I know, I was asking why they are unnecessary..

#3: thank you.. even if I'm not sure this module would actually improve in those 3 dimensions (see below), could this info be added to the module page or README?

  1. SEO: got some resources to share?
  2. Performance: you are altering/unsetting something that was already processed
  3. Privacy: could you provide some examples?

Thank you 🙏🏻

🇮🇹Italy kopeboy Milan

Yep, patch in #60 worked, and didn't seem to break anything! Thank you all!

🇮🇹Italy kopeboy Milan

To @sebastix: no, the issue is unrelated to pwa or advanced_pwa: I was just noting that the latter includes web push notifications and has a submodule specifically to correctly remove that feature.

To @ nk_: Unfortunately I had already Deleted the service worker and removed the test site, so I can't Unregister the service worker now because I don't see it anymore (as well as the error logs). At least this also means the original issue got fixed by itself, maybe Chrome just needed some time?

The big red "Unlock" button is supposed to clears service workers & subscriptions? It doesn't seem so, cause I've just reinstalled a new site with DANSE, push_framework, this module, registered a new key & service worker and subscribed myself with DANSE, but after clicking it, I can still see my subscription at /admin/reports/push-subscriptions, as well as the service workers in the Chrome console.

Regarding DANSE.. how to check the subscriptions? I don't see anything in the provided /admin/reports/danse, that's why I thought DANSE events are not even fired.

🇮🇹Italy kopeboy Milan

I had already given the instructions to reproduce! But here it's an even simpler one:

  1. Install a standard Drupal 10.3.6 site (I used DDEV & drush with ddev drush si
  2. Require & enable this module ddev drush composer require drupal/tour
  3. Check that there is a tour that should show up on Tour edit pages (/admin/config/user-interface/tour/manage/tour_edit)
  4. Go to edit itself or any other tour, eg:/admin/config/user-interface/tour/manage/tours]
  5. Click on the "No tour" button in the toolbar to start the tour

You can see the same problem on all 3 of the default tours provided, as well as new tour you might create, as I said in #1.

The problem is with the toolbar module and not with the navigation module. Just enable it and repeat the last 2 steps to see the problem "fixed".

🇮🇹Italy kopeboy Milan

What do you mean with a ticket? From who?

🇮🇹Italy kopeboy Milan

We should also support Drupal 11 since we're at it, please.

🇮🇹Italy kopeboy Milan

..or even a dependency on jquery_ui_slider module?

🇮🇹Italy kopeboy Milan

I confirm the issue and that that patch solves it. Please include in a release.

🇮🇹Italy kopeboy Milan

The difference is that with this you have the option to only edit the field if it didn't have a value (which is a condition that you could copy in a VBO action only with custom code, or by using eca_vbo module), and the benefit of not having to filter and select the entities to update: you automatically update all the entities that have that field, directly from the field settings form, so I would say it's pretty convenient for this specific use case, ie. when modifying the structure of your site (more specific than with VBO).

🇮🇹Italy kopeboy Milan

I'm not the maintainer but I just installed the module on Drupal 10.3.6, with admin_toolbar disabled, and I didn't get any warnings or errors.. the module seems to be working fine (not with the new core's nagivation module though).

Could you provide the steps or some details on how to reproduce the errors?

🇮🇹Italy kopeboy Milan

Yeah, here it is. I'm still a noob at this.. is there a way to open an issue fork and propose a MR before opening the issue on Drupal.org?

Production build 0.71.5 2024