Skip to content

Instantly share code, notes, and snippets.

@ikorgik
ikorgik / index.php
Last active August 16, 2018 13:42
Import config programmatically in Drupal 8
<?php
use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Config\StorageComparer;
use Drupal\Core\Config\ConfigException;
/**
* Imports configurations programmaticaly in Drupal 8.
*
* Makes the same action as `drush cim -y`.
* Based on the code from config.drush.inc:drush_config_import method.
@ikorgik
ikorgik / name.php
Last active December 30, 2015 11:29
<?php
$query = new EntityFieldQuery();
$terms = $query->entityCondition('entity_type', 'taxonomy_term')
->entityCondition('bundle', $voc_name)
->fieldCondition('field_tags_show_as_filter', 'value', 1)
->execute();
$result = array();
if (!empty($terms)) {
foreach($terms['taxonomy_term'] as $term) {
@ikorgik
ikorgik / gist:5729527
Created June 7, 2013 14:10
Code example
<?php
/**
* @file
* Web analytics.
*/
/**
* Implements hook_help().
*/
function web_analyt_help($section) {