Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I want to add some to user picture div. Currently it has user-picture
class. I am using bootstrap frame work for responsive design. So want to add class col-md-2
.
But user-picture.tpl.php
has hard coded
<?php if ($user_picture): ?>
<div class="user-picture">
<?php print $user_picture; ?>
</div>
<?php endif; ?>
So my code in my theme template file function template_preprocess_user_picture has no effect.
If I am doing mistake, then please give me guidance.
I am attaching path for it. I have changed line from <div class="user-picture">
to <div class="<?php print $classes; ?>">
Comment | File | Size | Author |
---|---|---|---|
#2 | user-picture-tpl-2313085-2.patch | 384 bytes | tkuldeep17 |
Comments
Comment #1
tkuldeep17 CreditAttribution: tkuldeep17 commentedComment #2
tkuldeep17 CreditAttribution: tkuldeep17 commentedComment #3
mgiffordIs this also an issue in D8? It either needs to be fixed there or proven that it isn't required there before it can be brought into D7.
Comment #4
bocaj CreditAttribution: bocaj commentedThis is definitely an issue in D7. I haven't gotten into D8 enough yet to know if the problem still is present there or not. This patch works as expected.
Comment #5
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedHm, clever. I was going to say we can't do this because it removes the existing "user-picture" class, but actually that still winds up getting printed because template_preprocess() adds it as a default class (based on the fact that the theme hook is named "user_picture"). So I think it's all good.
This shouldn't be relevant for Drupal 8 since the user picture is a standard field in Drupal 8.
Committed to 7.x - thanks!
Comment #8
spencerthayer CreditAttribution: spencerthayer commentedThis is annoying. Has this been fixed yet without a patch?