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.
Before:
function theme_views_slideshow_main_section($id, $hidden_elements, $plugin) {
$output = "\n\n" . '<div id="views_slideshow_' . $plugin . '_main_' . $id . '" class="views_slideshow_' . $plugin . '_main views_slideshow_main">' . "\n ";
$output .= $hidden_elements;
$output .= '</div><!--close views_slideshow_' . $plugin . '_main_' . $id . "-->\n\n";
return $output;
}
After:
function theme_views_slideshow_main_section($id, $hidden_elements, $plugin) {
$classes = array(
"views_slideshow_${plugin}_main",
'views_slideshow_main',
);
$attributes['class'] = implode(' ', $classes);
$attributes['id'] = "views_slideshow_${plugin}_main_${id}";
$attributes = drupal_attributes($attributes);
return "<div$attributes>$hidden_elements</div>";
}
I think it's a lot cleaner and easier to work with. I'm happy to hear any ways this could be further improved.
Comment | File | Size | Author |
---|---|---|---|
#7 | 713750-theme_views_slideshow_main_section4.patch | 40.77 KB | psynaptic |
#3 | 713750-theme_views_slideshow_main_section3.patch | 40.78 KB | psynaptic |
#2 | 713750-theme_views_slideshow_main_section2.patch | 1.22 KB | psynaptic |
#1 | 713750-theme_views_slideshow_main_section.patch | 2.66 KB | psynaptic |
Comments
Comment #1
psynaptic CreditAttribution: psynaptic commentedPatch attached.
Comment #2
psynaptic CreditAttribution: psynaptic commentedSorry, last patch was contaminated.
Here's another clean one.
Comment #3
psynaptic CreditAttribution: psynaptic commentedI spent the night going crazy on this module. I hope you approve of the changes.
Comment #4
psynaptic CreditAttribution: psynaptic commentedMore accurate title.
BTW: I'd love to be co-maintainer if you like what you see.
Comment #5
psynaptic CreditAttribution: psynaptic commentedComment #6
Standart CreditAttribution: Standart commented"Implementats hook_help()."
You may not have a space between quotes and the
.
(dot).Check
scripts/code-style.pl
in your Drupal dir.Comment #7
psynaptic CreditAttribution: psynaptic commentedThis is the new standard for Drupal 7, it is in preparation for porting to 7.
Typo fixed.
Is this patch otherwise fine?
Comment #8
Standart CreditAttribution: Standart commentedI like it!
In line 276, 280, 649, and 653: double spaces
I personally would pefer
over
.
In .tpl files shouldn't we do something like
instead of
?
The quote-space thing is interesting. Whole Drupal 6 code base does not put a space after a quote but I couldn't find any hint about it. The coding standard only contains space-quote-space...
Comment #9
psynaptic CreditAttribution: psynaptic commentedThe spacing around the concatenation operator used to be to not have a space on the side of the quote e.g.
But to follow other languages and for readability it was changed for D7.
I agree with your other comments but I have been liking simple variables embedded in strings recently, maybe I'm getting a bit obsessive.
Comment #10
psynaptic CreditAttribution: psynaptic commentedThis got committed to DRUPAL-6--1. I'd love to know if there are other improvements to the code you know about.
Comment #11
Standart CreditAttribution: Standart commentedGreat!
You probably mean DRUPAL-6--2...
Comment #12
psynaptic CreditAttribution: psynaptic commentedGood catch, DRUPAL-6--2 ;)