Skip to main content
Found the correct path i think with Joomla Dialog
Source Link
Marco
  • 691
  • 5
  • 14

For one of my projects (Custom Module) I would like to have a "com_menus"-styled modal to select an article - unfortunately it looks like this is not a "default form field type".

Based on my investigations of the com_menus item.xml (where such a field got rendered) the effective "article selector" is hidden behind a field type called "menutype" which looks to me like a core-custom dynamic field which renders a field (-template) based on the field above named "menutype".

If Single Article is selected it loads a field of type modal-select (modalSelect) -> but this only renders the effective inputfield with readonly - no buttons no functionality (which is obvious when checking the source code).

In the com_menus file structure there is in layouts an extra-buttons.php which looks like it renders the additional Select Button. But I have no clue how this is implemented and for me it looks a bit like "component-magic" which I cannot adapt in a module.

All in all I'm lost - I know I could simply create a fancy-list item getting all articles and having a search option there but i think on large sites this would not be the best / performant practice.

Did anyone already figured out how to create such a modal article selector field which makes use of the com_content modal article select layout?

Edit: I'm aware of the general concepts described here

Edit 2: Ok it looks like I was only searching for the wrong terms I've found this "by accident":

JoomlaDialog

Which throwed this solution onto my screen:

...
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('joomla.dialog');
$wa->useScript('joomla.dialog-autocreate');
$html = '<button class="btn btn-primary" type="button" data-joomla-dialog=\'{"popupType": "iframe", "width":"80vw", "height": "80vh", "src":"index.php?option=com_content&view=articles&tmpl=component&layout=modal"}\'>Click</button>';
...

Which can be used in a Custom Form field indeed - now I only need to know how to "transfer back" the selection into my input field (transmitting the article ID back which has been selected).

For one of my projects (Custom Module) I would like to have a "com_menus"-styled modal to select an article - unfortunately it looks like this is not a "default form field type".

Based on my investigations of the com_menus item.xml (where such a field got rendered) the effective "article selector" is hidden behind a field type called "menutype" which looks to me like a core-custom dynamic field which renders a field (-template) based on the field above named "menutype".

If Single Article is selected it loads a field of type modal-select (modalSelect) -> but this only renders the effective inputfield with readonly - no buttons no functionality (which is obvious when checking the source code).

In the com_menus file structure there is in layouts an extra-buttons.php which looks like it renders the additional Select Button. But I have no clue how this is implemented and for me it looks a bit like "component-magic" which I cannot adapt in a module.

All in all I'm lost - I know I could simply create a fancy-list item getting all articles and having a search option there but i think on large sites this would not be the best / performant practice.

Did anyone already figured out how to create such a modal article selector field which makes use of the com_content modal article select layout?

Edit: I'm aware of the general concepts described here

For one of my projects (Custom Module) I would like to have a "com_menus"-styled modal to select an article - unfortunately it looks like this is not a "default form field type".

Based on my investigations of the com_menus item.xml (where such a field got rendered) the effective "article selector" is hidden behind a field type called "menutype" which looks to me like a core-custom dynamic field which renders a field (-template) based on the field above named "menutype".

If Single Article is selected it loads a field of type modal-select (modalSelect) -> but this only renders the effective inputfield with readonly - no buttons no functionality (which is obvious when checking the source code).

In the com_menus file structure there is in layouts an extra-buttons.php which looks like it renders the additional Select Button. But I have no clue how this is implemented and for me it looks a bit like "component-magic" which I cannot adapt in a module.

All in all I'm lost - I know I could simply create a fancy-list item getting all articles and having a search option there but i think on large sites this would not be the best / performant practice.

Did anyone already figured out how to create such a modal article selector field which makes use of the com_content modal article select layout?

Edit: I'm aware of the general concepts described here

Edit 2: Ok it looks like I was only searching for the wrong terms I've found this "by accident":

JoomlaDialog

Which throwed this solution onto my screen:

...
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('joomla.dialog');
$wa->useScript('joomla.dialog-autocreate');
$html = '<button class="btn btn-primary" type="button" data-joomla-dialog=\'{"popupType": "iframe", "width":"80vw", "height": "80vh", "src":"index.php?option=com_content&view=articles&tmpl=component&layout=modal"}\'>Click</button>';
...

Which can be used in a Custom Form field indeed - now I only need to know how to "transfer back" the selection into my input field (transmitting the article ID back which has been selected).

informed that i know about the general concepts
Source Link
Marco
  • 691
  • 5
  • 14

For one of my projects (Custom Module) I would like to have a "com_menus"-styled modal to select an article - unfortunately it looks like this is not a "default form field type".

Based on my investigations of the com_menus item.xml (where such a field got rendered) the effective "article selector" is hidden behind a field type called "menutype" which looks to me like a core-custom dynamic field thatwhich renders a templatefield (-template) based on the field above named "menutype" - if.

If Single Article is selected it loads a field of type modal-select (modalSelect) -> but this only renders the effective inputfield with readonly - no buttons no functionality (which is obvious when checking the source code).

In the com_menus file structure there is in layouts an extra-buttons.php which looks like it renders the additional Select Button. But I have no clue how this is implemented and for me it looks a bit like "component-magic" which I cannot adapt in a module.

All in all I'm lost - I know I could simply create a fancy-list item getting all articles and having a search option there but i think on large sites this would not be the best / performant practice.

Did anyone already figured out how to create such a modal article selector field which makes use of the com_content modal article select layout?

Edit: I'm aware of the general concepts described here

For one of my projects (Custom Module) I would like to have a "com_menus"-styled modal to select an article - unfortunately it looks like this is not a "default form field type".

Based on my investigations of the com_menus item.xml (where such a field got rendered) the effective "article selector" is hidden behind a field type called "menutype" which looks to me like a core-custom dynamic field that renders a template based on the field named "menutype" - if Single Article is selected it loads a field of type modal-select (modalSelect) -> but this only renders the effective inputfield with readonly.

In the com_menus file structure there is in layouts an extra-buttons.php which looks like it renders the additional Select Button. But I have no clue how this is implemented and for me it looks a bit like "component-magic" which I cannot adapt in a module.

All in all I'm lost - I know I could simply create a fancy-list item getting all articles and having a search option there but i think on large sites this would not be the best / performant practice.

Did anyone already figured out how to create such a modal article selector field which makes use of the com_content modal article select layout?

For one of my projects (Custom Module) I would like to have a "com_menus"-styled modal to select an article - unfortunately it looks like this is not a "default form field type".

Based on my investigations of the com_menus item.xml (where such a field got rendered) the effective "article selector" is hidden behind a field type called "menutype" which looks to me like a core-custom dynamic field which renders a field (-template) based on the field above named "menutype".

If Single Article is selected it loads a field of type modal-select (modalSelect) -> but this only renders the effective inputfield with readonly - no buttons no functionality (which is obvious when checking the source code).

In the com_menus file structure there is in layouts an extra-buttons.php which looks like it renders the additional Select Button. But I have no clue how this is implemented and for me it looks a bit like "component-magic" which I cannot adapt in a module.

All in all I'm lost - I know I could simply create a fancy-list item getting all articles and having a search option there but i think on large sites this would not be the best / performant practice.

Did anyone already figured out how to create such a modal article selector field which makes use of the com_content modal article select layout?

Edit: I'm aware of the general concepts described here

Source Link
Marco
  • 691
  • 5
  • 14

Select Article Field like it is used in com_menu to select an article in a PopUp

For one of my projects (Custom Module) I would like to have a "com_menus"-styled modal to select an article - unfortunately it looks like this is not a "default form field type".

Based on my investigations of the com_menus item.xml (where such a field got rendered) the effective "article selector" is hidden behind a field type called "menutype" which looks to me like a core-custom dynamic field that renders a template based on the field named "menutype" - if Single Article is selected it loads a field of type modal-select (modalSelect) -> but this only renders the effective inputfield with readonly.

In the com_menus file structure there is in layouts an extra-buttons.php which looks like it renders the additional Select Button. But I have no clue how this is implemented and for me it looks a bit like "component-magic" which I cannot adapt in a module.

All in all I'm lost - I know I could simply create a fancy-list item getting all articles and having a search option there but i think on large sites this would not be the best / performant practice.

Did anyone already figured out how to create such a modal article selector field which makes use of the com_content modal article select layout?