Skip to content

Commit

Permalink
better performance
Browse files Browse the repository at this point in the history
array_filter is only needed if there are elements in the array
  • Loading branch information
Minei3oat committed Sep 14, 2016
1 parent e25bd91 commit b27783e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/cms/html/bootstrap.php
Expand Up @@ -633,9 +633,9 @@ public static function startAccordion($selector = 'myAccordian', $params = array
$script[] = "\t.on('hidden', " . $onHidden . ")";
}

$parents = array_key_exists(__METHOD__, static::$loaded) ? array_column(static::$loaded[__METHOD__], 'parent') : array();
$parents = array_key_exists(__METHOD__, static::$loaded) ? array_filter(array_column(static::$loaded[__METHOD__], 'parent')) : array();

if ($opt['parent'] && empty(array_filter($parents)))
if ($opt['parent'] && empty($parents))
{
$script[] = "
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
Expand Down

0 comments on commit b27783e

Please sign in to comment.