Drupal登录隐藏字段

时间:2016-10-10 11:17:13

标签: drupal drupal-7

我有两种不同用户类型的登录表单,我想区分用户

带有隐藏字段。 我想在我的表单中为“流动用户”写一个隐藏字段。

我的表单如下所示,但我无法从视图中看到隐藏字段

来源,我该怎么做呢?

page--user--login.tpl.php
---------------------------
 <div id="tabs">

      <ul>
    <li class="len-emp"><a href="#tabs-1">Fluid EMPLOYEE</a></li>
    <li><a href="#tabs-2">NON Fluid EMPLOYEE</a></li>
    <div class="clear-fix"></div>
    </ul>
      <div id="tabs-1" class="content">
      <?php print $messages; ?>
      <?php print render($page['content']); ?> 

      </div>

       <div id="tabs-2" class="content">
      <?php print $messages; ?>
      <?php print render($page['content']); ?>
      <div class="user-login-links">
  <span class="register-link"><a href="register">Create account</a></span><span class="password-link"><a href="password">Forgot Password</a></span>
    </div>
      </div>

    </div>

template.php
----------------
function mytheme_preprocess_user_login(&$variables) 
{
$variables['user-login-form']['edit-name']['#title'] = t('User ID');
  $variables['form']['name']['#attributes']['placeholder'] = $variables['form']['name']['#title'];
  $variables['form']['pass']['#attributes']['placeholder'] = $variables['form']['pass']['#title'];  
  $variables['form']['fluiduser']['#attributes']['placeholder'] = $variables['form']['fluiduser']['#title'];   
  $variables['form']['actions']['submit']['#attributes']['value'] = 'Login';
}

user-login.tpl.php
--------------------
    print drupal_render($form['name']);

    print drupal_render($form['pass']);    

  print drupal_render($form['fluiduser']);  

0 个答案:

没有答案