Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Adding

On function setSettings in install.php add following code

Code Block
php
php
<?php
public function setSettings()
{
    $this->settings = [
        'td_can_user_privacy' => [
            'var_name' => 'td_can_user_privacy',
            'info' => 'Allow user add privacy',
            'description' => 'Enable this setting in case you want your user can use privacy during adding new todo list',
            'type' => Core\App\Install\Setting\Site::TYPE_RADIO,
            'value' => '1',
        ],
    ];
}

...

  • array_key and var_name: They should be the same. In this case, we use: td_can_user_privacy. It's unique var_name that you can call this setting. Moreover, you should use you own app's prefix (like "td", stands for "to do") for your settings in order not to conflict with other settings.
  • info: Short information about this setting.
  • description: Full information about this setting.
  • type: Type of this setting.
  • value: Default value of this setting

...

On function setUserGroupSettings in install.php add following code

Code Block
php
php
<?php
public function setUserGroupSettings()
{
    $this->user_group_settings = [
        'td_can_add_new_todo_list'          => [
            'var_name' => 'td_can_add_new_todo_list',
            'info'     => 'Can add new todo list?',
            'type'     => \Core\App\Install\Setting\Groups::TYPE_RADIO,
            'value'    => [
                "1" => "1",
                "2" => "1",
                "3" => "1",
                "4" => "1",
                "5" => "0"
            ],
            'options'  => \Core\App\Install\Setting\Groups::$OPTION_YES_NO
        ],
    ];
}

...

  • array_key and var_name: They should be the same. In this case, we use: td_can_add_new_todo_list. It's unique var_name that you can call this user group setting. (View above settings' naming rule)
  • info: Description for your user group setting
  • type: Type of this user group setting.
  • value: Default value of this user group setting per each user group (user group ID)

...

Code Block
php
php
<?php
$value = user('td_can_add_new_todo_list');

Next Chapter