get('slogan')); // array_push($head_title, [ // 'name' => $site_config->get('name'), // ]); // $vars['head_title'] = $head_title; $description = [ '#tag' => 'meta', '#attributes' => [ 'name' => 'description', 'content' => $site_config->get('slogan'), ], ]; $vars['page']['#attached']['html_head'][] = [$description, 'description']; // $gv = [ // '#tag' => 'meta', // '#attributes' => [ // 'name' => 'google-site-verification', // 'content' => "Y6PSbMfj67bXtMRAT-mFTAxrIeZPzC5jWSpH3M7yhkk", // ], // ]; // $vars['page']['#attached']['html_head'][] = [$gv, "google-site-verification"]; } 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=='' ? '' : $system_path )); } /** * Implements hook_form_alter */ function materiotheme_form_user_login_form_alter(&$form, FormStateInterface $form_state, $form_id) { // dpm($form_id, 'form_id'); // dpm($form, 'form'); $form['name']['#attributes']['placeholder'] = (string) $form['name']['#title']; unset($form['name']['#title']); $form['pass']['#attributes']['placeholder'] = (string) $form['pass']['#title']; unset($form['pass']['#title']); } /** * Implements hook_theme_suggestions_HOOK_alter(). */ /** * Prepares variables for image formatter templates. * * Default template: image-formatter.html.twig. * * @param array $variables * An associative array containing: * - item: An ImageItem object. * - item_attributes: An optional associative array of html attributes to be * placed in the img tag. * - 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=='' ? '' : $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; } }