/**
  * @Access("system: access settings")
  */
 public function settingsAction()
 {
     return ['$view' => ['title' => __('Userprofile settings'), 'name' => 'bixie/userprofile/admin/settings.php'], '$data' => ['fields' => array_values(Field::findAll()), 'config' => App::module('bixie/userprofile')->config()]];
 }
Example #2
0
    }
}, 'uninstall' => function ($app) {
    $util = $app['db']->getUtility();
    if ($util->tableExists('@userprofile_field')) {
        $util->dropTable('@userprofile_field');
    }
    if ($util->tableExists('@userprofile_value')) {
        $util->dropTable('@userprofile_value');
    }
    // remove the config
    $app['config']->remove('bixie/userprofile');
}, 'updates' => ['1.2.0' => function ($app) {
    $util = $app['db']->getUtility();
    if ($util->tableExists('@userprofile_field')) {
        $table = $util->listTableDetails('@userprofile_field');
        if (!$table->hasColumn('slug')) {
            $table->addColumn('slug', 'string', ['length' => 255]);
            $util->alterTable((new Comparator())->diffTable($util->listTableDetails('@userprofile_field'), $table));
            foreach (Field::findAll() as $field) {
                $field->save(['slug' => $app->filter($field->label, 'slugify')]);
            }
        }
    }
    if ($util->tableExists('@userprofile_value')) {
        $table = $util->listTableDetails('@userprofile_value');
        if (!$table->hasColumn('data')) {
            $table->addColumn('data', 'json_array', ['notnull' => false]);
            $util->alterTable((new Comparator())->diffTable($util->listTableDetails('@userprofile_value'), $table));
        }
    }
}]];