E
E
EA-EKB2019-06-03 14:28:16
MODX
EA-EKB, 2019-06-03 14:28:16

How to set default parameters for the plugin in modExtra in _build/elements/plugins.php?

In order to study modExtra, I am writing a feedback module and encountered the following problem: when specifying the default parameters for the plugin in the _build/elements/plugins.php file (which processes the AJAX request when submitting the form):

return [
    'Feedback' => [
        'file' => 'feedback',
        'description' => '',
        'events' => [
            'OnWebPagePrerender' => [],
        ],
        'properties' => [
            'fields' => [
                'type' => 'textfield',
                'value' => 'author,phone,email,comment',
            ],
        ],
    ],
];
for some reason, after installing the package, instead of the name of the parameter, the default value is null, the value is displayed correctly. I did it by analogy with the _build/elements/snippets.php file. I rummaged through the sources of all packages based on modExtra known to me, but I did not find anything like it in any of them. Apparently the name of the default parameter is indicated differently from the snippets, but how?
Although no! How to pass snippet parameters to a plugin? Entering parameters in the session when calling the snippet is not suitable, since theoretically there can be as many calls to this snippet as you want on one page. Passing through $_POST is also not an option, since you will have to add hidden fields with parameters to the form (or one with parameters in the form of json in value, because of which we will receive a fiery hello from fenom)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question