Skip to content

Instantly share code, notes, and snippets.

@aschiwi
aschiwi / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@aschiwi
aschiwi / gist:5690827
Created Jun 1, 2013
Use this line in your Drupal 8's phptemplate theme to tell Drupal you're using the phptemplate engine.
View gist:5690827
engine: phptemplate
@aschiwi
aschiwi / gist:5690836
Created Jun 1, 2013
Old way to print menus in Drupal 7 page.tpl.php.
View gist:5690836
<?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'clearfix')))); ?>
@aschiwi
aschiwi / gist:5690843
Created Jun 1, 2013
Print your menus like this for Drupal 8 phptemplate themes.
View gist:5690843
<?php print render($main_menu); ?>
@aschiwi
aschiwi / gist:5690860
Last active Dec 17, 2015
How to add classes and ids to main and secondary menu in Drupal 8. Add this to your theme's .theme file (in this case it's busy.theme). The .theme file is called template.php in Drupal 7.
View gist:5690860
/**
* Implements hook_preprocess_HOOK() for page.tpl.php
*/
function busy_preprocess_page(&$variables) {
// Pass the main menu and secondary menu to the template as render arrays.
if (!empty($variables['main_menu'])) {
$variables['main_menu']['#attributes']['id'] = 'main-menu';
$variables['main_menu']['#attributes']['class'] = array('links', 'clearfix');
}
if (!empty($variables['secondary_menu'])) {
View gist:5780513
<?php
/**
* Implements hook__wysiwyg_editor_settings_alter().
*/
function MODULENAME_wysiwyg_editor_settings_alter(&$settings, $context) {
global $base_url;
if ($context['profile']->editor == 'ckeditor') {
$skins_path = drupal_get_path('module', 'MODULENAME') . '/ckeditor/skins';
@aschiwi
aschiwi / gist:5848755
Created Jun 24, 2013
Include local.settings.php
View gist:5848755
<?php
/**
* Include local.settings.php
*
* The file is in .gitignore so we can safely use it for local configs.
*/
if (file_exists('sites/default/local.settings.php')) {
include('local.settings.php');
}
@aschiwi
aschiwi / gist:5848762
Created Jun 24, 2013
Example local.settings.php
View gist:5848762
<?php
// Database connection settings.
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'lokalerdatenbankname',
'username' => 'lokalerdatenbankbenutzer',
@aschiwi
aschiwi / update.sh
Last active Dec 18, 2015
Example update.sh
View update.sh
################################################################################
# Shell and drush commands to update the given installation
#
# Go to sites/all/scripts (e.g. cd sites/all/scripts) and type "sh update.sh"
# in your console/shell/Terminal.
#
# The commands have to be functional for any case after the initial installation
# installation. So on any set up after calling that script, the configuration
# must be the same.
#
@aschiwi
aschiwi / accordion.js
Created Jun 25, 2013
Put this in your theme
View accordion.js
/**
* @file
* Use accordions in node body.
*/
(function ($) {
Drupal.behaviors.undpaulAccordion = {
attach: function(context) {
$('#accordion').accordion({
You can’t perform that action at this time.