S
S
Sergey Zaigraev2016-10-11 07:09:36
Drupal
Sergey Zaigraev, 2016-10-11 07:09:36

Drupal 7 login form theming?

I'm trying to themize the login form, which by default opens at the link /user/login/ I
did everything as described in this article.
Added code to template.php

function aihal_theme() {
  $items = array();

  $items['user_login'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'aihal') . '/templates',
    'template' => 'user-login',
    'preprocess functions' => array(
       'aihal_preprocess_user_login'
    ),
  );

  return $items;
}
function aihal_preprocess_user_login(&$vars) {
  $vars['intro_text'] = t('This is my awesome login form');
}

created user-login.tpl.php
<p><?php print render($intro_text); ?></p>
<div class="aihal-user-login-form-wrapper">
  <?php print drupal_render_children($form) ?>
</div>

updated the cache, went to the page updated and nothing has changed.
Googled but never found a solution that worked for me. After I manage to themize the form, it is to change the html structure that I want to display it using Modal Forms .

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
penexe, 2016-10-11
@penexe

<?php print render($intro_text); ?>
replace with at
least

A
Anton Yankovsky, 2016-10-11
@webpavilion

Here, with a copy-paste of the code from the question, everything works:
h_1476181923_7246633_089c8703b5.jpeg

  • Carefully check the name of all files and the theme.
  • Have you cleared the cache? how exactly?
  • Surely user/login is no longer redefined to something custom?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question