Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#29479 closed feature request (duplicate)

Converts an associative array to an XML/HTML tag attribute string

Reported by: szepeviktor's profile szepe.viktor 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)

#1 @SergeyBiryukov
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #32192.

Note: See TracTickets for help on using tickets.