My Code: < /p>
redited plugin.php < /strong> < /p>
Код: Выделить всё
public function init(): void
{
parent::init();
// Render the template for my plugin.
Event::on(
View::class,
View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS,
function(RegisterTemplateRootsEvent $event) {
$event->roots['_jsonify'] = __DIR__ . '/src/templates';
}
);
// Register the event that should be triggered on this url.
Event::on(
UrlManager::class,
UrlManager::EVENT_REGISTER_CP_URL_RULES,
function(RegisterUrlRulesEvent $event) {
$event->rules['_jsonify/import/test'] = '_jsonify/import/test';
}
);
Craft::$app->onInit(function() {
$this->getJsonFile();
$this->decodeJsonFile();
});
}
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/76764309/custom-plugin-method-wont-be-triggered-when-submitting-ajax-request[/url]
Мобильная версия