'external', 'group' => CSS_DEFAULT, 'every_page' => TRUE]);
// drupal_add_css('https://www.plegi.cz/cmp/cmp.css?v=2', ['type' => 'external', 'group' => CSS_DEFAULT, 'every_page' => TRUE]);
// drupal_add_js('https://www.plegi.cz/cmp/cmp.js?v=2', ['type' => 'external', 'group' => JS_DEFAULT, 'every_page' => TRUE]);
drupal_add_css(':root {--cmp-btn-color: #e30613;}', 'inline');
}
/**
* @file
* template.php
*/
function loganceevisual_subtheme_css_alter(&$css) {
//$css['https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css']['data'] = 'sites/all/themes/loganceevisual_subtheme/css/font-awesome.min.css';
//$css['https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css']['type'] = 'file';
//kpr($css);
//unset($css['https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css']);
//$css['//cdn.jsdelivr.net/bootstrap/3.3.5/css/bootstrap.min.css']['data'] = 'sites/all/themes/loganceevisual_subtheme/css/bootstrap.min.css';
//$css['//cdn.jsdelivr.net/bootstrap/3.3.5/css/bootstrap.min.css']['type'] = 'file';
}
function loganceevisual_subtheme_preprocess_node(&$vars){
if($vars['type'] == 'product_display'){
// netusim preco, ale pre SK sa zobrazuje zlavnena cena v CZK
// na Dev1se to funguje. pravdepodobne bude problem niekde v Rules (mozno zle poradie)
// osetrujem to tu aj vo funkcii custom_module_commerce_cart_attributes_refresh_alter a v custom module.module custom_module_views_pre_render funkcia
$selected_product = commerce_product_load($vars['field_product_reference'][0]['product_id']);
$price = commerce_product_calculate_sell_price($selected_product);
$price_display = commerce_currency_format($price['amount'], $price['currency_code'], $product);
$price_display = str_replace(',00', '', $price_display);
$vars['content']['product:commerce_price'][0]['#markup'] = $price_display;
}
}
function loganceevisual_subtheme_preprocess_page(&$vars){
global $language;
$vars['phone_number'] = PHONE_NUMBER;
// CUSTOM LOGO
$vars['logo'] = 'https://shop.playzone.cz/sites/all/themes/loganceevisual_subtheme/img/logo-color.svg';
if(isset($vars['node'])){
$tid = $vars['node']->field_shop_category[LANGUAGE_NONE][0]['tid'];
$breadcrumb = drupal_get_breadcrumb();
$parent_terms = array_reverse(taxonomy_get_parents_all($tid));
foreach($parent_terms as $parent_term){
$term = taxonomy_term_load($parent_term->tid);
$term = i18n_taxonomy_localize_terms($term);
$uri = entity_uri('taxonomy_term', $term);
// Do not create links to own self if we are on a taxonomy/term page.
$breadcrumb[] = l(check_plain($term->name), $uri['path']);
}
drupal_set_breadcrumb($breadcrumb);
}
elseif($vars['theme_hook_suggestions'][0] == 'page__taxonomy'){
//kpr($vars);
$tid = arg(2);
$breadcrumb = array(0 => '', 1 => ''.t('Produkty').'');
$parent_terms = array_reverse(taxonomy_get_parents_all($tid));
foreach($parent_terms as $parent_term){
$term = i18n_taxonomy_localize_terms($parent_term);
$taxonomy_path_alias = drupal_get_path_alias('taxonomy/term/' . $term->tid);
if($term->tid != $tid){
$breadcrumb[] = l(check_plain($term->name), $taxonomy_path_alias);
}
}
drupal_set_breadcrumb($breadcrumb);
}
if(isset($vars['page']['content']['system_main']['#form_id']) && $vars['page']['content']['system_main']['#form_id'] == 'commerce_checkout_form_checkout'){
drupal_set_title(t('Checkout'));
}
if(isset($vars['page']['content']['system_main']['#form_id']) && $vars['page']['content']['system_main']['#form_id'] == 'commerce_checkout_form_shipping'){
drupal_set_title(t('Shipping'));
}
if(isset($vars['page']['content']['system_main']['#form_id']) && $vars['page']['content']['system_main']['#form_id'] == 'commerce_checkout_form_paymentmethod'){
drupal_set_title(t('Payment'));
}
if(isset($vars['page']['content']['system_main']['#form_id']) && $vars['page']['content']['system_main']['#form_id'] == 'commerce_checkout_form_review'){
drupal_set_title(t('Review order'));
}
if(isset($vars['page']['content']['system_main']['#form_id']) && $vars['page']['content']['system_main']['#form_id'] == 'commerce_checkout_form_complete'){
drupal_set_title(t('Checkout complete'));
}
// BREADCRUMB
/*if(arg(0)=='taxonomy'){
$breadcrumb = drupal_get_breadcrumb();
array_unshift($breadcrumb, ''.t('Home').'');
drupal_set_breadcrumb($breadcrumb);
}*/
}
/**
* Themes a select drop-down as a collection of radio buttons.
*
* @see http://api.drupal.org/api/function/theme_select/7
*
* @param array $vars
* An array of arrays, the 'element' item holds the properties of the element.
*
* @return string
* HTML representing the form element.
*/
function loganceevisual_subtheme_select_as_radios($vars) {
$element = &$vars['element'];
if (!empty($element['#bef_nested'])) {
return theme('select_as_tree', $vars);
}
$output = '';
foreach (element_children($element) as $key) {
if (isset($element['#bef_term_descriptions'][$key])) {
$element[$key]['#description'] = $element['#bef_term_descriptions'][$key];
}
// pridame ikony k terms
$img = '';
if(is_numeric($key)){
$term = taxonomy_term_load($key);
$file_uri = file_create_url($term->field_icon[LANGUAGE_NONE][0]['uri']);
$img = '';
}
$element[$key]['#title'] = ''.$img.''.$element[$key]['#title'].'';
$element[$key]['#default_value'] = NULL;
$element[$key]['#children'] = theme('radio', array('element' => $element[$key]));
$output .= theme('form_element', array('element' => $element[$key]));
}
return $output;
}