made card image switcher

This commit is contained in:
2019-06-11 18:04:46 +02:00
parent 5da3b3c90a
commit a771fd9d74
10 changed files with 132 additions and 50 deletions

View File

@@ -2,7 +2,7 @@
/**
* @file
* Functions to support theming in the edlp theme.
* Functions to support theming in the materio theme.
*/
use Drupal\Core\Url;
@@ -41,6 +41,10 @@ function materiotheme_preprocess_html(&$vars) {
// ]);
// $vars['head_title'] = $head_title;
global $base_url;
$theme = \Drupal::theme()->getActiveTheme();
$vars['#attached']['drupalSettings']['path']['themePath'] = $base_url .'/'. $theme->getPath();
$description = [
'#tag' => 'meta',
'#attributes' => [
@@ -65,15 +69,15 @@ function materiotheme_preprocess_page(&$vars){
// dsm($vars, 'vars');
}
function materiotheme_preprocess_node(&$vars){
$node = $vars['elements']['#node'];
$options = ['absolute' => TRUE];
$url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $options);
$system_path = $url->getInternalPath();
$vars['link_attributes'] = new Attribute(array(
'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path
));
}
// function materiotheme_preprocess_node(&$vars){
// $node = $vars['elements']['#node'];
// $options = ['absolute' => TRUE];
// $url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $options);
// $system_path = $url->getInternalPath();
// $vars['link_attributes'] = new Attribute(array(
// 'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path
// ));
// }
/**
* Implements hook_form_alter
@@ -104,21 +108,21 @@ function materiotheme_form_user_login_form_alter(&$form, FormStateInterface $for
* - image_style: An optional image style.
* - url: An optional \Drupal\Core\Url object.
*/
function materiotheme_preprocess_image_formatter(&$vars){
if(isset($vars['url'])){
$system_path = $vars['url']->getInternalPath();
$vars['link_attributes'] = new Attribute(array(
'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
'class' => array('ajax-link')
));
// dpm($vars);
}
}
// function materiotheme_preprocess_image_formatter(&$vars){
// if(isset($vars['url'])){
// $system_path = $vars['url']->getInternalPath();
// $vars['link_attributes'] = new Attribute(array(
// 'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
// 'class' => array('ajax-link')
// ));
// // dpm($vars);
// }
// }
function materiotheme_preprocess_links__language_block(&$vars){
// dpm($vars);
// foreach ($vars['links'] as $lang_code => $link) {
// $vars['links'][$lang_code]['text'] = $lang_code;
// $vars['links'][$lang_code]['link']['#title'] = $lang_code;
// }
}
// function materiotheme_preprocess_links__language_block(&$vars){
// // dpm($vars);
// // foreach ($vars['links'] as $lang_code => $link) {
// // $vars['links'][$lang_code]['text'] = $lang_code;
// // $vars['links'][$lang_code]['link']['#title'] = $lang_code;
// // }
// }