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.
isset - determines whether a variable is set
empty - determines whether a variable is empty
empty also works on array()
An empty $items passed to theme_item_list produces the following string '
'. HTML validators choke on such empty lists.
Replacing isset with !empty solves this problem.
Paddy.
Comment | File | Size | Author |
---|---|---|---|
#4 | theme_item_list_1.patch | 987 bytes | chx |
#2 | theme_item_list_0.patch | 566 bytes | chx |
theme-item-list.patch | 324 bytes | paddy_deburca | |
Comments
Comment #1
paddy_deburca CreditAttribution: paddy_deburca commentedThe following string should read as <ul></ul>
Comment #2
chx CreditAttribution: chx commentedWhile we are here, what about moving the whole thing into !empty($items). Do we want a div and a title when there is no list?
Comment #3
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedchx: I'd appreciate this, it has annoyed me for a long time.
Comment #4
chx CreditAttribution: chx commentedComment #5
drummLooks good. +1
Comment #6
chx CreditAttribution: chx commentedget this puppy in
Comment #7
Dries CreditAttribution: Dries commentedCommitted to HEAD. Thanks.
Comment #8
(not verified) CreditAttribution: commented