Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[com_fields] - don't traverse the tree #24515

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 1 addition & 36 deletions administrator/components/com_fields/models/fields.php
Expand Up @@ -181,42 +181,7 @@ protected function getListQuery()
if (($categories = $this->getState('filter.assigned_cat_ids')) && $context)
{
$categories = (array) $categories;
$categories = ArrayHelper::toInteger($categories);
$parts = FieldsHelper::extract($context);

if ($parts)
{
// Get the category
$cat = JCategories::getInstance(str_replace('com_', '', $parts[0]) . '.' . $parts[1]);

// If there is no category for the component and section, so check the component only
if (!$cat)
{
$cat = JCategories::getInstance(str_replace('com_', '', $parts[0]));
}

if ($cat)
{
foreach ($categories as $assignedCatIds)
{
// Check if we have the actual category
$parent = $cat->get($assignedCatIds);

if ($parent)
{
$categories[] = (int) $parent->id;

// Traverse the tree up to get all the fields which are attached to a parent
while ($parent->getParent() && $parent->getParent()->id != 'root')
{
$parent = $parent->getParent();
$categories[] = (int) $parent->id;
}
}
}
}
}

$categories = ArrayHelper::toInteger($categories);
$categories = array_unique($categories);

// Join over the assigned categories
Expand Down