Skip to content

Instantly share code, notes, and snippets.

Avatar

Aaron Froehlich a-fro

  • Cornell University
  • Ithaca, NY
View GitHub Profile
@a-fro
a-fro / mymodule.module
Created Feb 6, 2014
Node access example
View mymodule.module
function mymodule_node_access($node, $op, $account) {
$controlled_nids = array(
1,
2
);
if (isset($node->nid) && in_array($node->nid, $controlled_nids)) {
$acceptable_users = array(
'2',
);
View nav-sample.css
nav ul {
width: 100%;
display: table;
aside & { // in this case, our submenu markup is in the aside
display: block;
width: 150px; }
li {
display: table-cell;
View scss-example.css
h1 {
font-size: 2em;
font-weight: normal;
&.yell {
text-decoration: uppercase;
font-weight: bold;
}
}
View tweet_block.inc-SRP.php
<?php
/**
* @file
* Tweet block bean plugin.
*/
/**
* Require the twitteroauth library
*/
require_once(drupal_get_path('module','bean_tweets') . '/libraries/twitteroauth/twitteroauth.php');
View tweet_block.inc-1.1api.php
<?php
/**
* @file
* Tweet block bean plugin.
*/
/**
* Require the twitteroauth library
*/
require_once(drupal_get_path('module','bean_tweets') . '/libraries/twitteroauth/twitteroauth.php');
View gist:5354472
<?php
/**
* Implements hook_menu().
*/
function bean_tweets_menu() {
$items = array();
$items['admin/config/system/bean_tweets'] = array(
'title' => t('Bean Tweets OAuth'),
'description' => t('Configure OAuth for Bean Tweets module'),
'page callback' => 'drupal_get_form',
View gist:5274083
<?php
/**
* Implements hook_uninstall().
*/
function bean_tweets_uninstall() {
variable_del('twitter_consumer_key');
variable_del('twitter_consumer_secret');
variable_del('twitter_access_token');
variable_del('twitter_token_secret');
View gist:5274067
<?php
/**
* @file
* Bean admin page for setting up oAuth
*/
/**
* Admin form.
*/
function bean_tweets_admin($form, &$form_state) {
View gist:5263934
$conf['twitter_consumer_key'] = [consumer_key_here];
$conf['twitter_consumer_secret'] = [consumer_secret_here];
$conf['twitter_access_token'] = [access_token_here];
$conf['twitter_token_secret'] = [token_secret_here];
View gist:5222565
<?php
/**
* @file
* Tweet block bean plugin.
*/
/**
* Require the twitteroauth library
*/
require_once(drupal_get_path('module','bean_tweets') . '/libraries/twitteroauth/twitteroauth.php');