Skip to content

Instantly share code, notes, and snippets.

View maciejzgadzaj's full-sized avatar

Maciej Zgadzaj maciejzgadzaj

View GitHub Profile
@maciejzgadzaj
maciejzgadzaj / d8_disable_module.php
Last active February 24, 2017 23:42
Drupal 8: force disable module
$module_data = \Drupal::config('core.extension')->get('module');
unset($module_data['my_module']);
\Drupal::configFactory()->getEditable('core.extension')->set('module', $module_data)->save();
$siren = mt_rand(100000000, 999999999);
$key = (12 + 3 * ($siren % 97)) % 97;
print 'FR' . $key . $siren;
diff --git i/includes/services.runtime.inc w/includes/services.runtime.inc
index b7c7d3c..10a36d6 100644
--- i/includes/services.runtime.inc
+++ w/includes/services.runtime.inc
@@ -95,8 +95,8 @@ class ServicesArgumentException extends ServicesException {
function services_controller_execute($controller, $args = array(), $options = array()) {
$server_info = services_server_info_object();
if (!empty($server_info->debug)) {
- watchdog('services', 'Controller: <pre>@controller</pre>', array('@controller' => print_r($controller, TRUE)), WATCHDOG_DEBUG);
- watchdog('services', 'Passed arguments: <pre>@arguments</pre>', array('@arguments' => print_r($args, TRUE)), WATCHDOG_DEBUG);
@maciejzgadzaj
maciejzgadzaj / advancedqueue-additional_drush_commands-2790623-2.patch
Last active August 26, 2016 13:56
Additional drush commands and aliases for Drupal advancedqueue module
diff --git i/drush/advancedqueue.drush.inc w/drush/advancedqueue.drush.inc
index 8e24a28..8de61db 100644
--- i/drush/advancedqueue.drush.inc
+++ w/drush/advancedqueue.drush.inc
@@ -10,6 +10,7 @@
*/
function advancedqueue_drush_command() {
$items = array();
+
$items['advancedqueue-process-queue'] = array(
diff --git i/index.php w/index.php
index 8b83199..2efe8c9 100644
--- i/index.php
+++ w/index.php
@@ -16,6 +16,29 @@
*/
define('DRUPAL_ROOT', getcwd());
-require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
-drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
@maciejzgadzaj
maciejzgadzaj / unt.php
Last active August 29, 2015 14:27
Drupal: un-translate a translated string
global $language;
$locale_t = &drupal_static('locale');
$locale_strings = array_flip($locale_t[$language->language]['']);
$untranslated_value = strtr($translated_value, $locale_strings);
@maciejzgadzaj
maciejzgadzaj / settings.local.php
Last active August 29, 2015 14:20
Platform.sh routes for local dev environment
$routes = array(
'https://www.domain.local/' => (object) array(
'upstream' => 'drupal',
'original_url' => 'https://www.{default}/',
),
'http://blog.domain.local/' => (object) array(
'upstream' => 'drupal',
'original_url' => 'http://blog.{default}/',
),
'http://pro.domain.local/' => (object) array(
@maciejzgadzaj
maciejzgadzaj / gist:41022acc23ced950f1c7
Last active November 7, 2015 09:08
Domain Access on Platform.sh
/**
* Implements hook_domain_default_domains().
*/
function MYMODULE_domain_default_domains() {
$domains = array();
$domains['wipe-domain-tables'] = 'wipe-domain-tables';
$routes = (array) json_decode(base64_decode(getenv('PLATFORM_ROUTES')));
if (!empty($routes) && is_array($routes)) {
@maciejzgadzaj
maciejzgadzaj / Drupal: view: commerce_payment_transactions .php
Last active August 29, 2015 14:17
Export of Drupal admin view listing all commerce_payment_transaction entities
$view = new view();
$view->name = 'payment_transactions';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'commerce_payment_transaction';
$view->human_name = 'Payment transactions';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@maciejzgadzaj
maciejzgadzaj / gist:1061723
Created July 2, 2011 22:18
Implementation of hook_admin_paths_alter().
<?php
/**
* Implements hook_admin_paths_alter().
*/
function MYMODULE_admin_paths_alter(&$paths) {
$paths['node/*/edit'] = FALSE;
$paths['node/add'] = FALSE;
$paths['node/add/*'] = FALSE;
}