Skip to content

Instantly share code, notes, and snippets.

Avatar

Rick rickp2006

  • USC (Marshall School of Business)
  • Los Angeles
View GitHub Profile
@rickp2006
rickp2006 / location and type nested taxo
Created Jan 13, 2021
custom code to return items tagged with nested taxonomy terms
View location and type nested taxo
// This was added on 3/1/19, makes it so that taxonomy children will be returned by the Location filter.
if ($view->id() == 'occurrences') {
$exposed_inputs = $view->getExposedInput();
if (isset($exposed_inputs['field_location_target_id']) && !empty($exposed_inputs['field_location_target_id'])) {
$condition_group = $query->where;
foreach ($condition_group as $group => $conditions) {
foreach ($conditions['conditions'] as $condition => $condition_value) {
if ($condition_value['field'] == 'occurrence__field_location.field_location_target_id = :occurrence__field_location_field_location_target_id'
|| $condition_value['field'] == 'occurrence__field_location.field_location_target_id = :occurrence__field_location_field_location_target_id1') {
$tids = [];
@rickp2006
rickp2006 / SocialFeedCommands.php
Created Mar 18, 2019
SocialFeedCommands.php ported
View SocialFeedCommands.php
<?php
namespace Drupal\social_feed\Commands;
use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
use Drush\Commands\DrushCommands;
/**
* A Drush commandfile.
*
@rickp2006
rickp2006 / SocialFeedCommands.php
Created Mar 18, 2019
SocialFeedsCommands.php created by Generate (original)
View SocialFeedCommands.php
<?php
namespace Drupal\social_feed\Commands;
use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
use Drush\Commands\DrushCommands;
/**
* A Drush commandfile.
*
@rickp2006
rickp2006 / drush.services.yml
Created Mar 18, 2019
Drush Services YML file created by Generate
View drush.services.yml
services:
social_feed.commands:
class: \Drupal\social_feed\Commands\SocialFeedCommands
tags:
- { name: drush.command }
@rickp2006
rickp2006 / social_feed.drush.inc
Created Mar 18, 2019
Porting to drush 9, social_feed.drush.inc, original file
View social_feed.drush.inc
<?php
use Drupal\Core\Queue\QueueInterface;
use Drupal\Core\Queue\QueueWorkerInterface;
use Drupal\Core\Queue\SuspendQueueException;
/**
* Implements hook_drush_command().
*/
function social_feed_drush_command() {