drupal..how to modify the style of the login or register shown in content
I have a wierd problem that I can't seem to find the solution, probably it is very simple. the text is this: Login or register to ad开发者_运维技巧d comments
<span>
<a href="/user/login?destination=node%2F1179%23comment-form">Login</a> or
<a href="/user/register?destination=node%2F1179%23comment-form">register</a>
to add comments
</span>
I want to customize this and add some classes for the links in order to personalize it
Override theme_comment_post_forbidden. To do that, in your theme (say it's called "example"), copy the code in the function that Drupal provides and make the appropriate changes.
function example_comment_post_forbidden() {
...
return t('<a class="login-link" href="@login">Login</a> or <a class="register-link"
href="@register">register</a> to post comments', array('@login' => url('user/login',
array('query' => $destination)), '@register' => url('user/register', array('query' =>
$destination))));
...
}
Notice that I added a class attribute to each a element. Again, make sure you copy all the code and make changes only where you need to. Clear the cache to make sure Drupal registers the theme function.
No need to add class if you can match these links using css selector. For example, with drupal 7 and default theme, you can use :
.comment_forbidden a
redeclare that form using hook_form_alter and add some attributes to those fields.
精彩评论