Tremestieri Etneo (CT)
Account created on 27 March 2007, about 18 years ago
#

Recent comments

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

Whoops! I looked for issues with the error code and the database update and couldn't find that!
Thanks!

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

1 year later... better late than never...

The right link in @astringer's post, with the solution to this issue too, should be Add an entity operation instead of a user list Add an entity operation instead of a user list Needs review

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

Hi, @robertoperuzzo, I finally understood where I was failing. I was trying to apply the patch over module version 4.0.1. Using dev version the patch applied and I can confirm it works for me.

Thanks!

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

Couldn't apply patch as is. I think because of this missing row in iubenda_integration.module:

define('IUBENDA_INTEGRATION_TOKEN_NAME', basename(__FILE__, '.module'));
🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

Updated to 2.5 and I get this couple of warnings:

Warning: Undefined variable $spammasteremail in spammaster_form_validate() (line 575 of modules/contrib/spammaster/spammaster.module).
...
Warning: Undefined variable $spammasteremail in spammaster_form_validate() (line 614 of modules/contrib/spammaster/spammaster.module).

As far as I can tell, this can be fixed setting the variable to null before the if section (eg. line 565).

Besides this, I get a WSOD on anonymous user with a GuzzleHttp\Exception\RequestException in my local environment, but this desn't look to be related to this issue, so I'm going to open a new one.

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

Hi pedro-alves, thank you for your reply.
I'm on PHP 8.1 and understand why to use "null !== expression" as alternative to isset().

I want to add that while trying to test the issue fork I rolled-back to the 2.3 and got no Warning but a WSOD as anonymous user. I'm not on the dev environment at the moment, but I'll check 2.5 and report ASAP.

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

1 year after followup, but I think this can help the community.

Another nice solution I suggest is using the HTTP Client Error Status Block Condition module with the default Login block, a contributed alternative or a custom one.

Just place the block in a region of your choice and select the 403 (forbidden) HTTP status in the visibility tabs.

It's D10 compatible, pretty easy to use and very versatile. Plus you don't need to redirect that is more coherent with the OP and the D7 Logintoboggan feature.

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

After a while I made my own solution since #5 won't work with a multi-valued field.

In my import process section I managed to get two arrays one for remote URLs and one for file descriptions:

_attachments_urls_array = [
  0 => 'https://oldsite.com/path/to/files/attachment_1.pdf',
  1 => 'https://oldsite.com/path/to/files/attachment_2.zip',
  2 => 'https://oldsite.com/path/to/files/attachment_3.mp3',
];

_attachments_labels_array = [
  0: 'My PDF document',
  1: 'My ZIP archive',
  2: 'My song',
]

First one is the source of my field_attachments multivalue file field working nice using file_import plugin from Migrate files (extended) module.

To apply file descriptions I figured how to patch the module but changes were too many and I walked to another solution.

What I did is an implementation of the PRE_ROW_SAVE event (ref. MigrateEvents).

Of course you need a custom module but you can use the one where you have your migration configurations.

First add a custom event subscriber (src/EventSubscriber/YourModuleSubscriber.php):

namespace Drupal\your_module\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\migrate\Event\MigrateEvents;
use Drupal\migrate\Event\MigrateImportEvent;
use Drupal\migrate\Event\MigratePreRowSaveEvent;

/**
 * Your Migrations event subscriber.
 */
class YourModuleSubscriber implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    return [
      MigrateEvents::PRE_ROW_SAVE => ['onMigratePreRowSave'],
    ];
  }

  /**
   * Custom migration comtuting.
   *
   * @param \Drupal\migrate\Event\MigratePreRowSaveEvent $event
   *   The import event object.
   */
  public function onMigratePreRowSave(MigratePreRowSaveEvent $event) {
    $migration_id = $event->getMigration()->getBaseId();

    switch ($migration_id) {
      case 'your_migration_id':
        $row = $event->getRow();
        $destination = $row->getDestination();
        if (isset($destination['field_attachments'])) {
          $field_attachments = $destination['field_attachments'];
          foreach ($field_attachments as $index => $attachment) {
            if (isset($destination['_attachments_labels_array'][$index])) {
              $field_attachments[$index]['description'] = $destination['_attachments_labels_array'][$index];
            }
          }
          $row->setDestinationProperty('field_attachments', $field_attachments);
        }
        break;
      default:
        break;
    }
  }

}

Then add the related service in your module services file (create one if you don't have one) your_module.services.yml:

services:
  your_module.event_subscriber:
    class: Drupal\your_module\EventSubscriber\YourModuleSubscriber
    tags:
      - { name: event_subscriber }

I hope this helps.

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

Any news on the D10 compatible release? I'm waiting to fulfill a 9 to 10 upgrade.

Thx!

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

Hi @pedro-alves, thank you for your quick answer.

I confirm that the new version works as expected.

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

It's an old issue, but hope this helps.

Changing the getResults method with getResultsKeyedByRawValue solved for me.

Attaching patch.

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

@michiellucas, can you please format the code? Or add some documentation?

field_files:
  plugin: file_import
  source: uri
  destination: file_destination
  uid: uid
  skip_on_missing_source: true
field_files/description: description

Is this the right syntax?

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

I have the same issue running db updates after upgrading to 7.x-3.11.

I tried changing MySQL DB version 5.7 in my containered development environment, but didn't solve.

Following some answers of this StackOverflow question, I tried changing the table engine from MyISAM to InnoDB and this worked for me.

The query you can run it on phpMyAdmin or any other SQL client:

ALTER TABLE `panels_allowed_types` ENGINE=InnoDB;

If you use a prefix, add it to the table name or just get it from the error message.

Of course, you need to run the Drupal DB Update again.

🇮🇹Italy nessunluogo Tremestieri Etneo (CT)

Hi Pedro, I'll try to explain my issue in a better way.

I have a node/add form (for a specific node type) open to non verified users. I know it's a bad practice, but I can't change this. I want to add Spam Master protection to this /node/add/mycustomtype form.

In 1.73 (commit here) you introduced a generic SpamMasterElusiveService in place of SpamMasterLoginService but I didn't know how to use service with the node/add form. I watched for information and found this two articles:

The last one guides in adding a service to a custom form, but still can't figure how to do this with a node/add form.

Can you help?

Thank you in advance.

Production build 0.71.5 2024