更改用户/密码登录框的大小 [英] Change size of user/password login box

查看:146
本文介绍了更改用户/密码登录框的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何更改我正在尝试构建的drupal站点上的登录用户名/密码框的大小。我笨拙的通过主题,不知道在哪里找到需要更改的文件,以便有适合美学的框(因此文件路径将非常有用)。

I don't know how to change the size of the login username/password boxes on the drupal site that I'm trying to build. I'm stumbling through the theming, and don't know where to find the file that needs to be changed in order to have boxes that fits the aesthetic (so a file path would be very helpful).

我希望这是一个css解决方案。您可以在innovatefortomorrow [dot] org和我的firebug截图 http:/ /www.jonrwilson.com/user-login-form.png (我没有足够的声望点附加图片或两个超链接)。

I'm hoping it's a css solution. You can see the site first hand at innovatefortomorrow[dot]org and my firebug screenshot http://www.jonrwilson.com/user-login-form.png (I don't have enough reputation points to attach an image or two hyperlinks).

谢谢!

读这个!这是一个替代的答案!

推荐答案

好吧,你即将进入最激动人心的Drupal的复杂功能:形式API或简化的FAPI。一些理论先行,然后解决! :)

Ok... you are about to enter one of the most exciting and complex features of Drupal: the form API or - for brevity - FAPI. Some theory first, and then the solution! :)

Drupal中的所有表单都由 drupal_get_form()函数构建,该函数接受一个数组作为参数。数组中的每个字段基本上都是您的表单的一个字段,每个字段都有多个属性,每个字段都定义了该字段的附加特征,例如其默认值(如果是必需或可选),并且 - 是 - 在textfields的情况下...他们必须有多大!您可以在这里找到表单数组结构的详细说明。在drupal网站上

All forms in Drupal are built by the drupal_get_form() function, that accepts an array as parameter. Each field in the array is basically a field of your form, and each field has a number of proprieties, each of them define additional characteristics of the the field, like for example its default value, if it is required or optional and - yes - in the case of textfields... how large they have to be! You can find a detailed explanation of the structure of form arrays here on the drupal site.

表单API的优点是,呈现该窗体的函数在其构建过程中的各个时刻调用多个钩子过程,所以你可以实现这些钩子,以便在更改表单之前,先将其转换为浏览器。

The beauty of the form API is that the function that renders the form invokes a number of hooks at various moments during its building process, so you can implement these hooks in order to "alter" a form before it is finalised and sent to the browser.

表单更改最常见的钩子是< a href =http://api.drupal.org/api/function/hook_form_alter/6 =nofollow noreferrer> hook_form_alter() hook_form_FORM_ID_alter() 。第一个执行为由drupal引擎处理的任何表单,后者仅适用于名为FORM_ID的特定格式。我不会详细介绍表单API的内部工作,但在这里你可以阅读更多

The most commonly hooks for form alteration are hook_form_alter() and hook_form_FORM_ID_alter(). The first is executed for any form processed by the drupal engine, the latter only for the specific form named "FORM_ID". I will not get into any more details on the internal working of the form API, but here you can read more.

至于你的具体情况,我假设你正在使用标准的用户块 Drupal的。在这种情况下,我建议您以类似于以下形式实现 hook_form_FORM_ID_alter()

As for your specific case, I assume you are using the standard "user block" shipping with Drupal. In this case I suggest you implement hook_form_FORM_ID_alter() in a form similar to this one:

mymodule_form_user_login_block_alter(&$form, $form_state) {
  $form['pass']['#size'] = 43;
}

希望这有帮助! :)

这篇关于更改用户/密码登录框的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆