protected function views_plugin_cache::assetDiff in Views (for Drupal 7) 7.3
Computes the differences between two JS/CSS asset arrays.
Parameters
array $assets: The current asset array.
array $start_assets: The original asset array.
string $diff_function: The function that should be used for computing the diff.
Return value
array A CSS or JS asset array that contains all entries that are new/different in $assets.
1 call to views_plugin_cache::assetDiff()
- views_plugin_cache::gather_headers in plugins/
views_plugin_cache.inc - Gather out of band data, compare it to the start data and store the diff.
File
- plugins/
views_plugin_cache.inc, line 247 - Definition of views_plugin_cache.
Class
- views_plugin_cache
- The base plugin to handle caching.
Code
protected function assetDiff(array $assets, array $start_assets, $diff_function) {
$diff = $diff_function($assets, $start_assets);
// Cleanup the resulting array since drupal_array_diff_assoc_recursive() can
// leave half populated arrays behind.
foreach ($diff as $key => $entry) {
// If only the weight was different we can remove this entry.
if (count($entry) == 1 && isset($entry['weight'])) {
unset($diff[$key]);
}
elseif ($entry != $assets[$key]) {
$diff[$key] = $assets[$key];
}
}
return $diff;
}