Skip to content

Instantly share code, notes, and snippets.

company-project-repo:
 - wordpressproject1
- docker-compose.yml
- settings.php
 - drupalproject1
- docker-compose.yml
- sites
- multisite1/
- settings.local.php
- multisite2/
company-project-repo:
 - wordpressproject1
- docker-compose.yml
 - drupalproject1
- docker-compose.yml
 - drupalproject2
- docker-compose.yml
 - README.md
company-project-repo:
 - wordpressproject1
 - drupalproject1
 - drupalproject2
 - README.md
@iampuma
iampuma / recursive isset object or array properties drupal
Created January 28, 2016 15:40
recursive isset object or array properties drupal
/**
* Recursive isset for array or object properties.
*/
function recursiveIsset($variable, $checkArray, $i = 0) {
$new_var = null;
if (is_array($variable) && array_key_exists($checkArray[$i], $variable)) {
$new_var = $variable[$checkArray[$i]];
} else if (is_object($variable) && array_key_exists($checkArray[$i], $variable)) {
$new_var = $variable->$checkArray[$i];
@iampuma
iampuma / set-commerce-countries-list.js
Created November 30, 2015 09:33
set-commerce-countries-list.js
jQuery("#edit-instance-widget-settings-available-countries").val(["BE", "MT", "BG"]);
@iampuma
iampuma / druli.sh
Created September 13, 2015 14:36
drush alias login homepage
# Drush uli to en homepage
drush_uli() {
drush $1 uli | xargs -I % echo %?destination=/en
}
alias druli=drush_uli
@iampuma
iampuma / drupal-ajax-change-url.php
Last active September 11, 2015 14:02 — forked from keeprock/custom.module.php
Loads views with ajax.- Generating links with special addresses- Creating menu item with ajax page callback- Writing ajax callback with Drupal Ajax functions- Loading view with contextual filters (from url)- Replace view with Drupal Ajax functions
function custom_menu() {
$items = array();
$items['ajax/custom_module/custom_action/%/%'] = array(
'title' => 'Title',
'delivery callback' => 'ajax_deliver', // important here!
'page callback' => 'custom_module__pagecallback',
'page arguments' => array(3,4), // index starts with zero
'type' => MENU_CALLBACK,
@iampuma
iampuma / generate-drupal-alias.php
Last active September 11, 2015 13:41
Generate drupal alias on demand
/**
* Implements hook_menu().
*/
function HOOK_menu() {
$items['forum/topics/%taxonomy_term/%taxonomy_term'] = array(
'page callback' => '_HOOK_PAGE_CALLBACK_page',
'access arguments' => array('access content'),
);
// Generate your url where needed like so.
@iampuma
iampuma / remove-field-update-hook-updb.txt
Created September 11, 2015 12:37
remove fields update hook
/**
* Removes unused HOOK fields
*/
function HOOK_update_7000() {
$fields_remove = array(
'FIELD_NAME',
);
foreach ($fields_remove as $field_name) {
field_delete_field($field_name);
}
@iampuma
iampuma / vertical-align-content.css
Created September 1, 2015 18:05
css vertical align content
.bootstrapgrid {
text-align: center;
}
.bootstrapgrid:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -15px; /* Adjusts for spacing */