Skip to content

Instantly share code, notes, and snippets.

@allgood2386
Created October 1, 2013 17:06
Show Gist options
  • Save allgood2386/6781784 to your computer and use it in GitHub Desktop.
Save allgood2386/6781784 to your computer and use it in GitHub Desktop.
<?php
function custom_blocks_block_info() {
$blocks['left_social'] = array(
// info: The name of the block.
'info' => t('Social Header Left'),
);
return $blocks;
}
function custom_blocks_block_view($delta = '') {
$theme_image_path = base_path().path_to_theme().'/images';
// The $delta parameter tells us which block is being requested.
switch ($delta) {
case 'left_social':
// Create your block content here
//$block['subject'] = t('Sample Title Block');
$block['content'] = '
<span class="connect-label">CONNECT WITH ME!</span>
<span class="icon-stack">
<a href="/index/rss.xml">
<i class="icon-sign-blank icon-stack-base"></i>
<i class="icon-rss icon-light"></i>
</a>
</span>
<span class="icon-stack">
<a href="http://www.twitter.com">
<i class="icon-sign-blank icon-stack-base"></i>
<i class="icon-twitter icon-light"></i>
</a>
</span>
<span class="icon-stack">
<a href="http://www.facebook.com">
<i class="icon-sign-blank icon-stack-base"></i>
<i class="icon-facebook icon-light"></i>
</a>
</span>
';
break;
}
return $block;
}
function custom_blocks_block_configure($delta='') {
$form = array();
switch($delta) {
case 'left_social':
$form['social_block_facebook'] = array(
'#type' => 'checkbox',
'#title' => t('Facebook'),
'#default_value' => variable_get('social_block_facebook', 0),
'#options' => drupal_map_assoc(array(0,1)),
);
$form['social_block_twitter'] = array(
'#type' => 'checkbox',
'#title' => t('Facebook'),
'#default_value' => variable_get('social_block_twitter', 0),
'#options' => drupal_map_assoc(array(0,1)),
);
break;
}
return $form;
}
function custom_blocks_block_save($delta='', $edit = array()) {
switch($delta) {
case 'left_social':
variable_set('social_block_facebook', $edit['social_block_facebook']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment