Opened 9 years ago
Closed 8 years ago
#29479 closed feature request (duplicate)
Converts an associative array to an XML/HTML tag attribute string
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.0 |
Component: | Formatting | Keywords: | |
Focuses: | template | Cc: |
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.
Duplicate of #32192.