Opened 12 years ago
Closed 11 years ago
#29479 closed feature request (duplicate)
Converts an associative array to an XML/HTML tag attribute string
| Reported by: | szepe.viktor | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Formatting | Version: | 4.0 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: | template |
Description
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
Change History (1)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Duplicate of #32192.