Created
June 21, 2013 12:07
-
-
Save csakiistvan/5830767 to your computer and use it in GitHub Desktop.
Sminkbe social gombok
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php print $twitter_link; ?> | |
<?php print $facebook_link; ?> | |
<?php print $linkedin_link; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sminkedneve_preprocess_node(&$variables) { | |
$variables['linkedin_link'] = theme( | |
'linkedin_link', | |
array( | |
'nid' => $variables['nid'], | |
'title' => $variables['title'], | |
'summary' => $variables['body']['0']['safe_value'], | |
) | |
); | |
$variables['twitter_link'] = theme( | |
'twitter_link', | |
array( | |
'nid' => $variables['nid'], | |
'title' => $variables['title'], | |
) | |
); | |
$variables['facebook_link'] = theme( | |
'facebook_link', | |
array( | |
'nid' => $variables['nid'], | |
'title' => $variables['title'], | |
'summary' => $variables['body']['0']['safe_value'], | |
) | |
); | |
} | |
/** | |
* Implements hook_theme(). | |
*/ | |
function sminkedneve_theme($existing, $type, $theme, $path) { | |
return array( | |
'linkedin_link' => array( | |
'variables' => array('nid' => NULL, 'title' => NULL, 'summary' => NULL), | |
), | |
'twitter_link' => array( | |
'variables' => array('nid' => NULL, 'title' => NULL), | |
), | |
'facebook_link' => array( | |
'variables' => array('nid' => NULL, 'title' => NULL, 'summary' => NULL), | |
), | |
); | |
} | |
/** | |
* Implements hook_linkdin_link(). | |
*/ | |
function sminkedneve_linkedin_link($variables) { | |
global $base_url; | |
$query = array( | |
'mini' => 'true', | |
'url' => $base_url . '/node/' . $variables['nid'], | |
'title' => $variables['title'], | |
'summary' => substr(strip_tags($variables['summary']), 0, 300), | |
'source' => 'Drupal.hu', | |
); | |
$link = l( | |
t('linkedin'), | |
'http://www.linkedin.com/shareArticle', | |
array( | |
'query' => $query, | |
'attributes' => array('class' => array('linkedin')), | |
'html' => TRUE, | |
) | |
); | |
return $link; | |
} | |
/** | |
* Implements theme_twitter_link(). | |
*/ | |
function sminkedneve_twitter_link($variables) { | |
global $base_url; | |
$query = array( | |
'url' => $base_url . '/node/' . $variables['nid'], | |
'text' => $variables['title'], | |
); | |
$link = l( | |
t('twitter'), | |
'https://twitter.com/intent/tweet', | |
array( | |
'query' => $query, | |
'attributes' => array('class' => array('twitter')), | |
'html' => TRUE, | |
) | |
); | |
return $link; | |
} | |
/** | |
* Implements theme_facebook_link(). | |
*/ | |
function sminkedneve_facebook_link($variables) { | |
global $base_url; | |
$query = array( | |
'u' => $base_url . '/node/' . $variables['nid'], | |
); | |
$link = l( | |
t('facebook'), | |
'https://www.facebook.com/sharer/sharer.php', | |
array( | |
'query' => $query, | |
'attributes' => array('class' => array('facebook')), | |
'html' => TRUE, | |
) | |
); | |
return $link; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment