| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Modules; |
| 4 |
|
| 5 |
use FluentForm\App\Modules\Acl\Acl; |
| 6 |
use FluentForm\App\Databases\DatabaseMigrator; |
| 7 |
|
| 8 |
class Activator |
| 9 |
{ |
| 10 |
/** |
| 11 |
* This method will be called on plugin activation |
| 12 |
* @return void |
| 13 |
*/ |
| 14 |
public function handleActivation() |
| 15 |
{ |
| 16 |
// We are going to migrate all the database tables here. |
| 17 |
DatabaseMigrator::run(); |
| 18 |
|
| 19 |
// Assign fluentform permission set. |
| 20 |
Acl::setPermissions(); |
| 21 |
|
| 22 |
$this->setDefaultGlobalSettings(); |
| 23 |
$this->setCurrentVersion(); |
| 24 |
} |
| 25 |
|
| 26 |
private function setDefaultGlobalSettings() |
| 27 |
{ |
| 28 |
if(!get_option('_fluentform_global_form_settings')) { |
| 29 |
update_option('__fluentform_global_form_settings', array( |
| 30 |
'layout' => array( |
| 31 |
'labelPlacement' => 'top', |
| 32 |
'helpMessagePlacement' => 'with_label', |
| 33 |
'errorMessagePlacement' => 'inline', |
| 34 |
'cssClassName' => '' |
| 35 |
) |
| 36 |
)); |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
private function setCurrentVersion() |
| 41 |
{ |
| 42 |
update_option('_fluentform_installed_version', '1.2.4'); |
| 43 |
} |
| 44 |
} |