Skip to content

Instantly share code, notes, and snippets.

neetumorwani

Block or report user

Report or block neetumorwani

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@neetumorwani
neetumorwani / module.php
Created Apr 5, 2018 — forked from gwagroves/module.php
Drupal 8 Paragraphs: Add a theme suggestion based on the paragraph and the type of the current node.
View module.php
<?php
/**
* Implements theme_suggestions_HOOK_alter().
*/
function mytheme_theme_suggestions_paragraph_alter(array &$suggestions, array $variables) {
if ($node = \Drupal::routeMatch()->getParameter('node')) {
$paragraph = $variables['elements']['#paragraph'];
array_push($suggestions, 'paragraph__' . $paragraph->getType() . '__' . $node->getType());
}
}
@neetumorwani
neetumorwani / mymodule.js
Created Dec 18, 2017 — forked from SebCorbin/mymodule.js
Using highcharts with Drupal 7
View mymodule.js
(function ($) {
Drupal.behaviors.mymodule_charts = {
attach:function () {
if (Drupal.settings.mymodule.charts) {
for (var chart in Drupal.settings.mymodule.charts) {
new Highcharts.Chart(Drupal.settings.mymodule.charts[chart]);
}
}
}
};
View gist:d30716683d6ee1c6f6a3
<?php
/**
* @file
* Contains Drupal\akamai\Plugin\Purge\Purger\AkamaiPurger.
*/
namespace Drupal\akamai\Plugin\Purge\Purger;
use Drupal\purge\Plugin\Purge\Purger\PurgerBase;
use Drupal\purge\Plugin\Purge\Purger\PurgerInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
View gist:c6f111c4f5535dfc30a7
$purgeQueue = \Drupal::service('purge.queue');
$items = $purgeQueue->claim();
$newitems = array();
$uris = array();
foreach($items as $item) {
if($item->getPluginId()==='url') {
$newitems[] = $item;
}
}
You can’t perform that action at this time.