Account created on 19 August 2017, over 7 years ago
#

Recent comments

I have been bumping into this issue from time to time, and then I come here to grab the latest patch for the current Drupal version.

I also think some simpler patches / fixes shouldn't need to take 8 years and 4 major Drupal versions to get applied, regardless if there are specific tests developed.

Thank you at #111 for testing this, I can confirm patch #45 works for the time being, dpm and kint are essential to our dev process.

Thank you to everyone involved in the successive patches, I can confirm I was able to have notifications working again in my Drupal web app, though not with some work.

A few tips for other people struggling with this:

- After you apply the #38 patch to the latest 3.0.1 version, don't forget to run drush updb or update.php to get all the changes to the module's configuration in the db.

- The credentials json is found not on the firebase console like usual but on the google cloud console, search for "google service account credentials json"

- This might be obvious, but don't forget to import the needed classes at the top of your file:

use Drupal\firebase\Entity\Message;
use Drupal\firebase\Entity\MessageData;
use Drupal\firebase\Entity\Notification;
use Drupal\firebase\Entity\AndroidConfig;
use Drupal\firebase\Entity\ApnsConfig;

- This is the code that I'm using at the moment:

public static function firebase_message($token, $title, $body, $data)
    {
        $service = Drupal::service('firebase.message');
        $service->setRecipients($token);
        
        $notification = new Notification($title);
        $notification->setBody($body);
        
        $data = MessageData::fromArray($data);
          
        // Message
         $message = new Message($notification);
         $message->setData($data);
         $service->setMessage($message);
         // Android config
         $android_config = new AndroidConfig();
         $android_config->setPriority('high');
         $message->setAndroidConfig($android_config);
         // Apple config
         $apns_config = new ApnsConfig();
         $apns_config->setHeaders(['apns-priority' => '5']);
         $apns_config->setPayload(['aps'=> ['mutable-content' => 1, 'content-available' => 1]]);
         $message->setApnsConfig($apns_config);
        
          $result = $service->sendToTokens();
    }

Regards.

After trying everything for the better part of a day, I faced the simple fact that mymodule_theme_suggestions_alter and mymodule_theme were never going to work due to the active theme taking precedence / priority over whatever template your module suggests or defines. At least in my use case.

My specific problem: I needed to override a template defined by the theme, and I wanted to do that from my module, it didn't make sense to make a sub theme and add an unnecessary extension, versioning and overhead just to override one line of a twig in a theme.

Specifically, I wanted the site's logo on the menu toolbar to not point to <front> but to a custom url. That was it. Simple, right? Well, that functionality is not baked in, at least not in the theme I'm using and on most themes. I could have done it in a hackish, non-Drupal way, in 5 minutes with javascript. Anyways, this is what worked for me in Drupal 10.3:

/**
 * Implements hook_theme_registry_alter().
*/
function mymodule_theme_registry_alter(&$theme_registry) {
  if(isset($theme_registry['menu__toolbar__gin'])){
    $theme_registry['menu__toolbar__gin']['path'] = \Drupal::service('extension.list.module')->getPath('mymodule').'/templates';
  }
}

I found out that checking the theme_registry using Devel was of great help to just change the part that needed to be overwritten for my use case, I didn't want to redefine the whole array entry (hook), just the path.

After further testing, I found out there was an unrelated hook saving the submission before the route loaded the webform, thus triggering the update operations I was getting. My Bad.

I'm now getting the following exception:

RuntimeException: Controller "Drupal\az_blob_fs\Controller\AzBlobFsImageStyleDownloadController::deliver" requires that you provide a value for the "$required_derivative_scheme" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or there is a non-optional argument after this one. in Symfony\Component\HttpKernel\Controller\ArgumentResolver->getArguments() (line 110 of /opt/drupal/vendor/symfony/http-kernel/Controller/ArgumentResolver.php).

I imagine there are places where AzBlobFsImageStyleDownloadController::deliver gets called without providing the $required_derivative_scheme.

I'm not familiar enough with the module and the changes introduced by 10.3 but will try to give this a go when I get a bit of free time.

I think here are two unrelated problems: the OP appears to be having issues loading jQuery (probably a JS general problem), which might be helped by changing $ for jQuery as in the proposed patch.

I, however, have bumped into the issue of the flags not loading, etc. with an error in the setCountry function within mobile-number-form-element.js.

It turns out that sometimes, on first load, the setCountry function gets called with a null value before setting itself correctly to the chosen default value. In those cases, the script breaks and the flags never load, etc.

I will be posting a patch here later today, but wanted to leave a heads up, the quick workaround is to check if the value is null and return the function in other to prevent the errors from breaking the functionality.

as in:

function setCountry(country) {
          if(!country){
            return;
          }

          $input.parents('.country-select').find('.mobile-number-flag').removeClass($input.data('value'));
          $input.parents('.country-select').find('.mobile-number-flag').addClass(country.toLowerCase());
          $input.data('value', country.toLowerCase());

          var options = $input.get(0).options;
          for (var i = 0; i < options.length; i++) {
            if (options[i].value === country) {
              var prefix = options[i].label.match(/(\d+)/)[0];
              $input.parents('.country-select').find('.prefix').text('(+' + prefix + ')');
            }
          }
        }
      

I applied the proposed patch and got the following:

 TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in count() (line 98 of /home/mmex/public_html/web/modules/contrib/metatag/src/Entity/Me  
  tatagDefaults.php).    

I changed line 98 to check if $tag is of type array:

if (is_array($tag) && count($tag) === 1) {
            return reset($tag);
        } 

I don't know how to create a MR.

In a modern project you would want to have composer.json under version control so others could composer install it, Drupal 10's recommended composer project is still missing a useful gitignore.

The patch works great for the BLT config-import scenario described above: installing from configuration without all the limitations, caveats and inconsistencies of a profile's config install scenario (read: no core.extension support). In our case, we wrote a BLT Task Hook to run on new sites install only, thus, when deploying updates we avoid existing sites configuration from being overwritten by the drush cex/cim cycle.

Production build 0.71.5 2024