[wp-trac] [WordPress Trac] #29479: Converts an associative array to an XML/HTML tag attribute string
WordPress Trac
noreply at wordpress.org
Tue Sep 2 22:59:59 UTC 2014
#29479: Converts an associative array to an XML/HTML tag attribute string
-----------------------------+-----------------------------
Reporter: szepe.viktor | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: trunk
Severity: normal | Keywords:
Focuses: template |
-----------------------------+-----------------------------
Could WP have a core function to converts an associative array to an HTML
tag attribute string?
Drupal has it:
{{{
function drupal_attributes(array $attributes = array()) {
foreach ($attributes as $attribute => &$data) {
$data = implode(' ', (array) $data);
$data = $attribute . '="' . check_plain($data) . '"';
}
return $attributes ? ' ' . implode(' ', $attributes) : '';
}
}}}
https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_attributes/7
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29479>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list