Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,30 @@ public function display($tpl = null)
}
} else {
// In article associations modal we need to remove language filter if forcing a language.
if ($forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'CMD')) {
$forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'CMD');

if ($forcedLanguage) {
// If the language is forced we can't allow to select the language, so transform the language selector filter into a hidden field.
$languageXml = new \SimpleXMLElement('<field name="language" type="hidden" default="' . $forcedLanguage . '" />');
$this->filterForm->setField($languageXml, 'filter', true);

// Also, unset the active language filter so the search tools is not open by default with this filter.
unset($this->activeFilters['language']);
}

$this->filterForm->addControlField('forcedLanguage', $forcedLanguage);
}

// If filter by category is active we need to know the extension name to filter the categories
$extensionName = $this->escape($this->state->get('filter.extension'));
$this->filterForm->setFieldAttribute('category_id', 'extension', $extensionName, 'filter');

// Add form control fields
$this->filterForm
->addControlField('extension', $this->state->get('filter.extension', ''))
->addControlField('task', '')
->addControlField('boxchecked', '0');

parent::display($tpl);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ public function display($tpl = null)
$this->checkTags = true;
}

Factory::getApplication()->getInput()->set('hidemainmenu', true);
$input = Factory::getApplication()->getInput();
$forcedLanguage = $input->get('forcedLanguage', '', 'cmd');

$input->set('hidemainmenu', true);

// If we are forcing a language in modal (used for associations).
if ($this->getLayout() === 'modal' && $forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'cmd')) {
if ($this->getLayout() === 'modal' && $forcedLanguage) {
// Set the language field to the forcedLanguage and disable changing it.
$this->form->setValue('language', null, $forcedLanguage);
$this->form->setFieldAttribute('language', 'readonly', 'true');
Expand All @@ -123,6 +126,12 @@ public function display($tpl = null)
$this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage);
}

// Add form control fields
$this->form
->addControlField('task', '')
->addControlField('return', $input->getBase64('return', ''))
->addControlField('forcedLanguage', $forcedLanguage);

if ($this->getLayout() !== 'modal') {
$this->addToolbar();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,7 @@
<?php endif; ?>
<?php endif; ?>

<input type="hidden" name="extension" value="<?php echo $extension; ?>">
<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<?php echo HTMLHelper::_('form.token'); ?>
<?php echo $this->filterForm->renderControlFields(); ?>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@

<?php endif; ?>

<input type="hidden" name="extension" value="<?php echo $extension; ?>">
<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<input type="hidden" name="forcedLanguage" value="<?php echo $app->getInput()->get('forcedLanguage', '', 'CMD'); ?>">
<?php echo HTMLHelper::_('form.token'); ?>
<?php echo $this->filterForm->renderControlFields(); ?>

</form>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@
<?php echo HTMLHelper::_('uitab.endTabSet'); ?>

<?php echo $this->form->getInput('extension'); ?>
<input type="hidden" name="task" value="">
<input type="hidden" name="return" value="<?php echo $input->getBase64('return'); ?>">
<input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>">
<?php echo HTMLHelper::_('form.token'); ?>
<?php echo $this->form->renderControlFields(); ?>
</div>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ public function display($tpl = null)
throw new GenericDataException(implode("\n", $errors), 500);
}

$input = Factory::getApplication()->getInput();
$forcedLanguage = $input->get('forcedLanguage', '', 'cmd');

// If we are forcing a language in modal (used for associations).
if ($this->getLayout() === 'modal' && $forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'cmd')) {
if ($this->getLayout() === 'modal' && $forcedLanguage) {
// Set the language field to the forcedLanguage and disable changing it.
$this->form->setValue('language', null, $forcedLanguage);
$this->form->setFieldAttribute('language', 'readonly', 'true');
Expand All @@ -117,6 +120,12 @@ public function display($tpl = null)
$this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage);
}

// Add form control fields
$this->form
->addControlField('task', '')
->addControlField('return', $input->getBase64('return', ''))
->addControlField('forcedLanguage', $forcedLanguage);

if ($this->getLayout() !== 'modal') {
$this->addToolbar();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ public function display($tpl = null)
} else {
// In article associations modal we need to remove language filter if forcing a language.
// We also need to change the category filter to show show categories with All or the forced language.
if ($forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'CMD')) {
$forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'CMD');

if ($forcedLanguage) {
// If the language is forced we can't allow to select the language, so transform the language selector filter into a hidden field.
$languageXml = new \SimpleXMLElement('<field name="language" type="hidden" default="' . $forcedLanguage . '" />');
$this->filterForm->setField($languageXml, 'filter', true);
Expand All @@ -155,8 +157,15 @@ public function display($tpl = null)
// One last changes needed is to change the category filter to just show categories with All language or with the forced language.
$this->filterForm->setFieldAttribute('category_id', 'language', '*,' . $forcedLanguage, 'filter');
}

$this->filterForm->addControlField('forcedLanguage', $forcedLanguage);
}

// Add form control fields
$this->filterForm
->addControlField('task', '')
->addControlField('boxchecked', '0');

parent::display($tpl);
}

Expand Down
5 changes: 1 addition & 4 deletions administrator/components/com_content/tmpl/article/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@
<div class="hidden"><?php echo $hidden_fields; ?></div>
<?php endif; ?>

<input type="hidden" name="task" value="">
<input type="hidden" name="return" value="<?php echo $input->getBase64('return'); ?>">
<input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>">
<?php echo HTMLHelper::_('form.token'); ?>
<?php echo $this->form->renderControlFields(); ?>
</div>
</form>
10 changes: 3 additions & 7 deletions administrator/components/com_content/tmpl/articles/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@

$workflow_state = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.state', 'com_content.article');
$workflow_featured = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.featured', 'com_content.article');

$this->filterForm->addControlField('transition_id', '');
endif;

$assoc = Associations::isEnabled();
Expand Down Expand Up @@ -389,13 +391,7 @@
<?php endif; ?>
<?php endif; ?>

<?php if ($workflow_enabled) : ?>
<input type="hidden" name="transition_id" value="">
<?php endif; ?>

<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<?php echo HTMLHelper::_('form.token'); ?>
<?php echo $this->filterForm->renderControlFields(); ?>
</div>
</div>
</div>
Expand Down
5 changes: 1 addition & 4 deletions administrator/components/com_content/tmpl/articles/modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,7 @@

<?php endif; ?>

<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<input type="hidden" name="forcedLanguage" value="<?php echo $app->getInput()->get('forcedLanguage', '', 'CMD'); ?>">
<?php echo HTMLHelper::_('form.token'); ?>
<?php echo $this->filterForm->renderControlFields(); ?>

</form>
</div>
12 changes: 11 additions & 1 deletion administrator/components/com_menus/src/View/Item/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,11 @@ public function display($tpl = null)
return;
}

$input = Factory::getApplication()->getInput();
$forcedLanguage = $input->get('forcedLanguage', '', 'cmd');

// If we are forcing a language in modal (used for associations).
if ($this->getLayout() === 'modal' && $forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'cmd')) {
if ($this->getLayout() === 'modal' && $forcedLanguage) {
// Set the language field to the forcedLanguage and disable changing it.
$this->form->setValue('language', null, $forcedLanguage);
$this->form->setFieldAttribute('language', 'readonly', 'true');
Expand All @@ -118,6 +121,13 @@ public function display($tpl = null)
$this->form->setFieldAttribute('parent_id', 'language', '*,' . $forcedLanguage);
}

// Add form control fields
$this->form
->addControlField('task', '')
->addControlField('forcedLanguage', $forcedLanguage)
->addControlField('menutype', $input->get('menutype', ''))
->addControlField('fieldtype', '', ['id' => 'fieldtype']);

if ($this->getLayout() !== 'modal') {
$this->addToolbar();
} else {
Expand Down
11 changes: 10 additions & 1 deletion administrator/components/com_menus/src/View/Items/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,25 @@ public function display($tpl = null)
}
} else {
// In menu associations modal we need to remove language filter if forcing a language.
if ($forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'CMD')) {
$forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'CMD');

if ($forcedLanguage) {
// If the language is forced we can't allow to select the language, so transform the language selector filter into a hidden field.
$languageXml = new \SimpleXMLElement('<field name="language" type="hidden" default="' . $forcedLanguage . '" />');
$this->filterForm->setField($languageXml, 'filter', true);

// Also, unset the active language filter so the search tools is not open by default with this filter.
unset($this->activeFilters['language']);
}

$this->filterForm->addControlField('forcedLanguage', $forcedLanguage);
}

// Add form control fields
$this->filterForm
->addControlField('task', '')
->addControlField('boxchecked', '0');

// Allow a system plugin to insert dynamic menu types to the list shown in menus:
$this->getDispatcher()->dispatch('onBeforeRenderMenuItems', new BeforeRenderMenuItemsViewEvent('onBeforeRenderMenuItems', [
'subject' => $this,
Expand Down
3 changes: 3 additions & 0 deletions administrator/components/com_menus/src/View/Menu/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public function display($tpl = null)
throw new GenericDataException(implode("\n", $errors), 500);
}

// Add form control fields
$this->form->addControlField('task', '');

parent::display($tpl);
$this->addToolbar();
}
Expand Down
6 changes: 1 addition & 5 deletions administrator/components/com_menus/tmpl/item/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@
<?php echo HTMLHelper::_('uitab.endTabSet'); ?>
</div>

<input type="hidden" name="task" value="">
<input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>">
<input type="hidden" name="menutype" value="<?php echo $input->get('menutype', '', 'cmd'); ?>">
<?php echo $this->form->getInput('component_id'); ?>
<?php echo HTMLHelper::_('form.token'); ?>
<input type="hidden" id="fieldtype" name="fieldtype" value="">
<?php echo $this->form->renderControlFields(); ?>
</form>
4 changes: 1 addition & 3 deletions administrator/components/com_menus/tmpl/items/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@
<?php endif; ?>
<?php endif; ?>

<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<?php echo HTMLHelper::_('form.token'); ?>
<?php echo $this->filterForm->renderControlFields(); ?>
</div>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions administrator/components/com_menus/tmpl/menu/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
<?php endif; ?>

<?php echo HTMLHelper::_('uitab.endTabSet'); ?>
<input type="hidden" name="task" value="">
<?php echo HTMLHelper::_('form.token'); ?>
<?php echo $this->form->renderControlFields(); ?>
</div>
</form>
5 changes: 5 additions & 0 deletions components/com_content/src/View/Form/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ public function display($tpl = null)
$this->showSaveAsCopy = true;
}

// Add form control fields
$this->form
->addControlField('task', '')
->addControlField('return', $this->return_page ?? '');

$this->_prepareDocument();

parent::display($tpl);
Expand Down
4 changes: 1 addition & 3 deletions components/com_content/tmpl/form/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@

<?php echo HTMLHelper::_('uitab.endTabSet'); ?>

<input type="hidden" name="task" value="">
<input type="hidden" name="return" value="<?php echo $this->return_page; ?>">
<?php echo HTMLHelper::_('form.token'); ?>
<?php echo $this->form->renderControlFields(); ?>
</fieldset>
<div class="d-grid gap-2 d-sm-block mb-2">
<button type="button" class="btn btn-primary" data-submit-task="article.apply">
Expand Down
Loading