I would like to have a custom action on the pages app that opens up a dialog with one field for a comment and two actions, namely cancel
and commit
. The commit action calls the custom ExportToGitCommand class.
I defined a custom action definition and class action for the pages app in magnolia:
public class ExportToGitCommandAction extends AbstractCommandAction<ExportToGitCommandActionDefinition>{
public ExportToGitCommandAction(ExportToGitCommandActionDefinition definition, JcrItemAdapter item,
CommandsManager commandsManager, UiContext uiContext, SimpleTranslator i18n) {
super(definition, item, commandsManager, uiContext, i18n);
// TODO Auto-generated constructor stub
}
public ExportToGitCommandAction(ExportToGitCommandActionDefinition definition, List<JcrItemAdapter> items,
CommandsManager commandsManager, UiContext uiContext, SimpleTranslator i18n) {
super(definition, items, commandsManager, uiContext, i18n);
// TODO Auto-generated constructor stub
}
}
In the Config app I defined myAction:
MyAction
class ->ch.xxx.module.versioning.ExportToGitCommandActionDefinition
command -> /modules/xxx-module-versioning/commands/versioning/gitexport
dialogName -> /modules/xxx-module-versioning/dialogs/saveversion
The constructor in ExportToGitCommandAction
gets invoked but the dialog and command from myAction
are not. What methods do I need to implement so that the myAction
:
The custom command gitexport
code is:
public class ExportToGitCommand extends BaseRepositoryCommand {
@Override
public boolean execute(Context context) throws Exception {
//custom code here
}
}
Part of the solution
Under the pages app I created an action using the following configuration:
MyAction
class ->i nfo.magnolia.ui.framework.action.OpenCreateDialogActionDefinition
dialogName -> xxx-module-versioning:gitexport
icon -> icon-i-beacon
label -> MyAction
Under the xxx-module-versioning app I configured the dialog:
xxx-module-versioning
commands
dialogs
gitexport
form
actions
This is a possible solution that worked.
In the magnolia pages app in magnolia configuration configure a custom action:
In the respective module defined under dialogName define the dialog:
The custom class extends CommandActionDefinition
:
public class ExportToGitCommandActionDefinition extends CommandActionDefinition{
public ExportToGitCommandActionDefinition() {
this.setImplementationClass(ExportToGitCommandAction.class);
}