Skip to main content

Posts

Showing posts from October, 2017

Drupal 8.4 requires jQuery 3, which no longer supports load()

You might get this error Uncaught TypeError: a.indexOf is not a function at r.fn.init.r.fn.load (jquery.min.js?v=3.2.1:4) at Object.attach (scripts.js?v=8.4.0:1) at Object.Drupal.attachBehaviors (drupal.js?v=8.4.0:25) at drupal.init.js?v=8.4.0:16 at HTMLDocument.t (ready.min.js?v=1.0.8:4) Drupal 8.4  is using latest jQuery version 3.2 which does not support load() function. Instead of using load() , you can use .on(load,function(){})  $(window).on('load', function () { });

Feeds import - Skip importing item based on some condition

You can do this using hook_feeds_presave to check the data prior to it being saved. $item   parameter contains the current feed.  Check item on some condition. To skip an item to being import, use $entity->feeds_item->skip = TRUE; function mymodule_feeds_presave ( FeedsSource $source , $entity , $item ) { // check that this is fired only for the importer being used if ( $source -> importer -> id == 'my_custom_feeds_importer' ){ if ( $item [ 'mfgcode' ] < '18' ){ $entity -> feeds_item -> skip = TRUE ; drupal_set_message ( t ( "Skipping item" , 'warning' ); } } }