Skip to content

Instantly share code, notes, and snippets.

@yanniboi
yanniboi / Create, save, delete og_membership
Last active December 27, 2015 03:59
OG (Organic Groups) Snippets
<?php
$og_mem = og_membership_create($group_type, $gid, $entity_type, $etid, $field_name);
og_membership_save($og_mem);
dpm($og_mem);
og_membership_delete($og_mem->id);
@yanniboi
yanniboi / gist:7292130
Created November 3, 2013 16:40
Helpful scripts for blog automating.
#bible.conf
server {
listen 80;
server_name bible.six-gs.com ;
client_max_body_size 10M;
location / {
proxy_pass http://localhost:2777/;
proxy_set_header Host $host;
@yanniboi
yanniboi / InstagramBlockForm.php
Last active December 29, 2015 00:09
Form Class for Instagram Block module (drupal 8)
/**
* @file
* Contains \Drupal\instagram_block\Form\InstagramBlockForm.
*/
namespace Drupal\instagram_block\Form;
use Drupal\Core\Form\ConfigFormBase;
/**
@yanniboi
yanniboi / new.instagram_block.module
Last active December 29, 2015 00:09
Pages and Menu routing in Instagram Block (drupal-8)
function instagram_block_menu() {
$items['admin/config/content/instagram_block'] = array(
'title' => 'Instagram Block',
'description' => 'Configuration page for Instagram Block.',
'router_name' => 'instagram_block_admin_config_form',
);
return $items;
}
instagram_block_admin_config_form:
path: '/admin/config/content/instagram_block'
defaults:
_form: 'Drupal\instagram_block\Form\InstagramBlockForm'
requirements:
_permission: 'administer site configuration'
@yanniboi
yanniboi / InstagramBlockBlock.php
Last active February 14, 2018 17:49
Block Class for Instagram Block module (drupal 8)
/**
* @file
* Contains \Drupal\instagram_block\Plugin\Block\InstagramBlockBlock.
*/
namespace Drupal\instagram_block\Plugin\Block;
use Drupal\block\BlockBase;
use Drupal\block\Annotation\Block;
use Drupal\Core\Annotation\Translation;
@yanniboi
yanniboi / instagram-block-image.tpl.php
Created November 21, 2013 16:06
Writing a theme function and template for Instagram Block (drupal 7)
/**
* @file
* Default theme implementation of an Instagram image link.
*
* Available variables:
* - data: The entire data array returned from the Instagram API request.
* - href: The url to the Instagram post page.
* - src: The source url to the instagram image.
* - width: The display width of the image.
* - height: The display height of the image.
@yanniboi
yanniboi / instagram-block-image.html.twig
Created November 21, 2013 16:10
Writing a theme function and TWIG template for Instagram Block (drupal 8)
{#
/**
* @file
* Default theme implementation of an Instagram image link.
*
* Available variables:
* - data: The entire data array returned from the Instagram API request.
* - href: The url to the Instagram post page.
* - src: The source url to the instagram image.
* - width: The display width of the image.
@yanniboi
yanniboi / field_update_hook.php
Last active December 30, 2015 00:09
Code snippet for field creating update hook
<?php
/**
* Code snippet for field create update hook.
*/
function module_update_7001() {
$t = get_t();
$fields = array();
@yanniboi
yanniboi / devel.php
Created December 16, 2013 12:58
User login link without drush
<?php
global $user;
dpm(user_pass_reset_url($user) . '/login');