Created
September 8, 2014 14:11
-
-
Save develnk/aa60fad984a7d411fb2d to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Implements hook_preprocess_entity(). | |
*/ | |
function module_name_profile_preprocess_entity(&$vars) { | |
switch ($vars['entity_type']) { | |
case 'profile2': | |
// Use different template | |
$vars['theme_hook_suggestions'][] = "profile2__profile__{$vars['view_mode']}"; | |
$function_name = "module_name_profile_preprocess_profile2_profile_{$vars['view_mode']}"; | |
if (function_exists($function_name)) { | |
$function_name($vars); | |
} | |
break; | |
} | |
} | |
function module_name_profile_preprocess_profile2_profile_page(&$vars) { | |
//Состояние счёта | |
if (isset($vars['field_user_score'][0]['value']) && !is_null($vars['field_user_score'][0]['value'])) { | |
$vars['score'] = $vars['field_user_score'][0]['value']; | |
$vars['disable_class'] = ''; | |
$path = 'user/' . $vars['user']->uid . '/withdrawal'; | |
} | |
else { | |
$vars['score'] = 0; | |
$vars['disable_class'] = 'disabled'; | |
$path = 'profile-profile'; | |
} | |
$withdrawal_form_option = array( | |
'query' => drupal_get_destination(), | |
'html' => TRUE, | |
'attributes' => array( | |
'class' => array(''), | |
), | |
); | |
$vars['withdrawal_form'] = l('<span class="glyphicon glyphicon-eject"> Вывод</span>', $path, $withdrawal_form_option); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment