Make WordPress Core

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)

#1 @SergeyBiryukov
11 years ago

  • Milestone Awaiting Review
  • Resolution → duplicate
  • Status new → closed

Duplicate of #32192.

Note: See TracTickets for help on using tickets.