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
Use page tree view for forms #5423
Comments
How does this apply to forms but not to anything else? How do you know which news archive belongs to which page etc? I think finding a naming convention that works for you would be the best solution … |
News archive to wich page? We don't need any connection to pages or archives. Just a view option like page view or like a view by file management.
Naming convention will work as soon you don't have the same first letter for your form like your name conversion. |
Forms are not associated with any parent thus there can be no tree view. |
OK. It is not nice at all. But if there is no other solution, that mean, we have to take care of the length of forms. |
I think the requested feature is displaying a list ordered by a dynamic prefix. Or call it a prefix tree, but it's purely for the view, not the data. IMHO an interesting idea, but as @aschempp pointed out this is not limited to forms at all.
There is no easy solution for this. And it would involve cleaning up a lot of things first. So I think it's unlikely someone is going to do this in their free time. If we agree we want this and agree on a way this could be solved and you'll find someone that implements this, we would surely accept a PR. 😉 |
One naming convention i use (and that can be also be seen in the screenshot above) is to add something in square-brackets to the name. Grouping by that would be nice but @m-vo was quicker than me. (it's a suffix though) |
That's already (sort of) possible with |
It is not possible to set a field in the tl_form as a flag so that one can decide whether the form is a real form or serves as a directory? Then you could implement the dependency with another field. |
For example: // contao/dca/tl_form.php
use Contao\CoreBundle\DataContainer\PaletteManipulator;
$GLOBALS['TL_DCA']['tl_form']['fields']['groupTitle'] = [
'label' => ['Group', 'Set a group title.'],
'inputType' => 'text',
'eval' => ['tl_class' => 'w50', 'maxlength' => 255],
'flag' => 3,
'length' => 9999,
'sql' => ['type' => 'string', 'length' => 255, 'default' => ''],
];
$GLOBALS['TL_DCA']['tl_form']['list']['sorting']['fields'] = ['groupTitle', 'title'];
PaletteManipulator::create()
->addField('groupTitle', 'title_legend', PaletteManipulator::POSITION_APPEND)
->applyToPalette('default', 'tl_form')
; |
Or, if you want to group specifically by website roots: // contao/dca/tl_form.php
use Contao\CoreBundle\DataContainer\PaletteManipulator;
use Contao\PageModel;
$GLOBALS['TL_DCA']['tl_form']['fields']['site'] = [
'label' => ['Site', 'Choose a website root for grouping.'],
'exclude' => true,
'filter' => true,
'inputType' => 'select',
'foreignKey' => 'tl_page.title',
'options_callback' => static function(): array {
$sites = [];
foreach (PageModel::findByType('root', ['order' => 'sorting ASC']) ?? [] as $root) {
$sites[$root->id] = $root->title;
}
return $sites;
},
'eval' => ['tl_class' => 'w50', 'mandatory' => true],
'flag' => 3,
'length' => 9999,
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
];
$GLOBALS['TL_DCA']['tl_form']['list']['sorting']['fields'] = ['site', 'title'];
PaletteManipulator::create()
->addField('site', 'title_legend', PaletteManipulator::POSITION_APPEND)
->applyToPalette('default', 'tl_form')
; |
OK. So it's possible. Can't you include that in core? Even grouping with website root is actually the best solution for me. |
No, it should not be included in the core as this is something that is individual to your Contao instance. As you can see you can take full advantage of Contao's customizability. |
That‘s right. |
Description
The forms are displayed in alphabetical groups, one below the other. If you operate several websites within one installation, or have several forms within one installation, or have defined different languages and forms for a website, the display becomes confusing. Even renaming the forms by name does not help here.
For example, several websites in one installation:
Example for multi language website:
Can we implement an option for forms like page view to display or move the forms below a directory?
The text was updated successfully, but these errors were encountered: