From: Ricordisamoa Date: Wed, 10 Dec 2014 07:43:28 +0000 (+0000) Subject: Xml: Simplify processing of attributes in Xml::label X-Git-Tag: 1.31.0-rc.0~13011^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=de37b20c68b3f0b337d92787f4e7590f75189128;p=lhc%2Fweb%2Fwiklou.git Xml: Simplify processing of attributes in Xml::label Comment inserted by Antoine Musso with d86a3bc2177f79. Also fixed wrong indentation. Change-Id: I054762929413f90090b446c603b60ed9544c06d1 --- diff --git a/includes/Xml.php b/includes/Xml.php index 159f711464..c07ac73bef 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -368,12 +368,10 @@ class Xml { public static function label( $label, $id, $attribs = array() ) { $a = array( 'for' => $id ); - # FIXME avoid copy pasting below: - if ( isset( $attribs['class'] ) ) { - $a['class'] = $attribs['class']; - } - if ( isset( $attribs['title'] ) ) { - $a['title'] = $attribs['title']; + foreach ( array( 'class', 'title' ) as $attr ) { + if ( isset( $attribs[$attr] ) ) { + $a[$attr] = $attribs[$attr]; + } } return self::element( 'label', $a, $label );