123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?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');
-
-
-
-
-
- $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_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_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_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')
- ));
-
- }
- }
- function materiotheme_preprocess_links__language_block(&$vars){
-
- foreach ($vars['links'] as $lang_code => $link) {
- $vars['links'][$lang_code]['text'] = $lang_code;
- $vars['links'][$lang_code]['link']['#title'] = $lang_code;
- }
- }
|