Commit 4a42062b authored by Dries's avatar Dries
Browse files

- Patch #667038 by effulgentsia: optimize template_process().

parent 1f6a553c
...@@ -2288,9 +2288,12 @@ function template_process(&$variables, $hook) { ...@@ -2288,9 +2288,12 @@ function template_process(&$variables, $hook) {
$variables['classes'] = implode(' ', $variables['classes_array']); $variables['classes'] = implode(' ', $variables['classes_array']);
// Flatten out attributes, title_attributes, and content_attributes. // Flatten out attributes, title_attributes, and content_attributes.
$variables['attributes'] = drupal_attributes($variables['attributes_array']); // Because this function can be called very often, and often with empty
$variables['title_attributes'] = drupal_attributes($variables['title_attributes_array']); // attributes, optimize performance by only calling drupal_attributes() if
$variables['content_attributes'] = drupal_attributes($variables['content_attributes_array']); // necessary.
$variables['attributes'] = $variables['attributes_array'] ? drupal_attributes($variables['attributes_array']) : '';
$variables['title_attributes'] = $variables['title_attributes_array'] ? drupal_attributes($variables['title_attributes_array']) : '';
$variables['content_attributes'] = $variables['content_attributes_array'] ? drupal_attributes($variables['content_attributes_array']) : '';
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment