123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <?php
- use Drupal\Core\Url;
- use Drupal\Core\Link;
- use Drupal\Core\Form\FormStateInterface;
- use Drupal\Core\Template\Attribute;
- use Drupal\Component\Utility\Unicode;
- use Drupal\Core\Render\Element;
-
- function materiotheme_preprocess_html(&$vars) {
-
-
- $site_config = \Drupal::config('system.site');
-
-
-
-
-
-
-
-
-
-
- global $base_url;
- $theme = \Drupal::theme()->getActiveTheme();
- $vars['#attached']['drupalSettings']['path']['themePath'] = $base_url .'/'. $theme->getPath();
- $description = [
- '#tag' => 'meta',
- '#attributes' => [
- 'name' => 'description',
- 'content' => $site_config->get('slogan'),
- ],
- ];
- $vars['page']['#attached']['html_head'][] = [$description, 'description'];
-
-
-
-
-
-
-
-
- }
- function materiotheme_preprocess_page(&$vars){
-
- }
-
-
- function materiotheme_form_user_login_form_alter(&$form, FormStateInterface $form_state, $form_id) {
-
-
- $form['name']['#attributes']['placeholder'] = (string) $form['name']['#title'];
- unset($form['name']['#title']);
- $form['pass']['#attributes']['placeholder'] = (string) $form['pass']['#title'];
- unset($form['pass']['#title']);
- }
- function materiotheme_theme_suggestions_taxonomy_term_alter(&$suggestions, &$vars){
-
-
- $original = $vars['theme_hook_original'];
- $bundle = $vars['elements']['#taxonomy_term']->bundle();
- $viewmode = $vars['elements']["#view_mode"];
- $suggestions[] = $original.'__'.$bundle.'__'.$viewmode;
-
- }
- function materiotheme_theme_suggestions_field_alter(&$suggestions, &$vars){
- if($vars['element']["#entity_type"] === "commerce_product_variation"
- && $vars['element']["#bundle"] === "materio_product_variation_type"
- && $vars['element']["#field_name"] === "title"){
- $test = 'test';
- $original = $vars['theme_hook_original'];
- $entity_type = $vars['element']["#entity_type"];
- $bundle = $vars['element']["#bundle"];
- $field_name = $vars['element']["#field_name"];
- $viewmode = $vars['element']['#view_mode'];
- $suggestions[] = $original.'__'.$entity_type.'__'.$bundle.'__'.$field_name.'__'.$viewmode;
- }
- }
- function materiotheme_preprocess_commerce_product(array &$variables) {
- $test="test";
-
- if($variables['elements']['#view_mode'] === 'order_summary'
- || $variables['elements']['#view_mode'] === 'home_summary'){
- unset($variables['product']['variation_title']);
- unset($variables['product']['variation_field_description']);
- unset($variables['product']['variation_price']);
- unset($variables['product']['variation_field_multiple']);
- unset($variables['product']['variation_commerce_variation_cart_form']);
- }
- }
|