How can i check in the controller if a module exist?
If i remove my module, i will get an error.
Cheers, Maarten
To acces my module from the controller .
$formbuilder = $page->children()->filterBy('template', 'module.formbuilder')->first();
}
My Module
My controller
<?php
return function($site, $pages, $page) {
$formbuilder = $page->children()->filterBy('template', 'module.formbuilder')->first();
$form = uniform('contact-form', [
'required' => [
'name' => '',
'tel' => '',
'message' => '',
'_from' => 'email'
],
'validate' => [
'tel' => 'num'
],
'actions' => [
[
'_action' => 'email',
'to' => $formbuilder->to(),
'sender' => $formbuilder->send(),
'subject' => $formbuilder->subject() . ' {date}',
'snippet' => 'uniform-email-contact'
],
[
'_action' => 'email',
'sender' => $formbuilder->send(),
'subject' => 'Thank You For Contacting Us, {name}!',
'to' => get('_from'),
'message' => 'Thank you for contacting us today. We will be in touch soon!',
'snippet' => 'uniform-email-thanks'
],
[
'_action' => 'create-page',
'template' => 'client',
'prefix' => 'client-',
'parent' => page('app/contacts'),
]
]
]);
return compact('form');
};
