Skip to content

Commit

Permalink
Category field extends ModalSelectField
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedik committed Nov 6, 2023
1 parent 7b37b18 commit 8850c6a
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ public function setup(\SimpleXMLElement $element, $value, $group = null)
$this->canDo['propagate'] = ((string) $this->element['propagate'] == 'true') && \count($languages) > 2;

// Prepare Urls
$linkArticles = (new Uri())->setPath(Uri::base(true) . '/index.php');
$linkArticles->setQuery([
$linkItems = (new Uri())->setPath(Uri::base(true) . '/index.php');
$linkItems->setQuery([
'option' => 'com_categories',
'view' => 'categories',
'layout' => 'modal',
'tmpl' => 'component',
Session::getFormToken() => 1,
]);
$linkArticle = clone $linkArticles;
$linkArticle->setVar('view', 'category');
$linkItem = clone $linkItems;
$linkItem->setVar('view', 'category');
$linkCheckin = (new Uri())->setPath(Uri::base(true) . '/index.php');
$linkCheckin->setQuery([
'option' => 'com_categories',
Expand All @@ -93,8 +93,8 @@ public function setup(\SimpleXMLElement $element, $value, $group = null)
]);

if ($language) {
$linkArticles->setVar('forcedLanguage', $language);
$linkArticle->setVar('forcedLanguage', $language);
$linkItems->setVar('forcedLanguage', $language);
$linkItem->setVar('forcedLanguage', $language);

$modalTitle = Text::_('COM_CATEGORIES_SELECT_A_CATEGORY') . ' — ' . $this->getTitle();

Expand All @@ -103,10 +103,10 @@ public function setup(\SimpleXMLElement $element, $value, $group = null)
$modalTitle = Text::_('COM_CATEGORIES_SELECT_A_CATEGORY');
}

$urlSelect = $linkArticles;
$urlEdit = clone $linkArticle;
$urlSelect = $linkItems;
$urlEdit = clone $linkItem;
$urlEdit->setVar('task', 'category.edit');
$urlNew = clone $linkArticle;
$urlNew = clone $linkItem;
$urlNew->setVar('task', 'category.add');

$this->urls['select'] = (string) $urlSelect;
Expand Down

0 comments on commit 8850c6a

Please sign in to comment.