Outlast Apps - Custom app settings


Introduction

Custom app settings allow you to change the interface that admin users see when they click the settings button within the admin interface.

Create a custom app settings template

Create a new file /app/example/app_settings.html and give it the interface you need.

When you save the form, you need to POST the data to admin/oaapp/settings/save/. This will automatically reroute to your custom controller’s __app_settings_update() magic method.

Create a custom app settings controller

Here’s an example code that you could place in your custom app controller:

public function __app_settings_display(){
	$this->zajlib->template->show('/app/example/app_settings.html');
	exit();
}
public function __app_settings_update(){
	// You can do anything here. Typically we save data to the OaApp object's other field:
	$this->zajlib->variable->oaapp->set_these('other')->save();
	return $this->zajlib->ajax('ok');
}

The creation of the __app_settings_display method in your controller will also have the following effects:

  • a new tab entitled ‘Settings’ will show up in the app admin
  • other field data will no longer be editable from the other two tabs (Administration, Tags/Terms/Images)

App setting constants and defaults

You can use the __app_settings_load magic method to modify the app settings page options. This is run just before the default app settings page is displayed. You can use it, for example, to specify fixed categories for an app:

public function __app_settings_load(){
  $this->zajlib->variable->app_settings->categories = array(
    1=>"Category One",
    2=>"Category Two",
  );
}

Right now only adding fixed categories to your app setup page is supported. No other custom app settings are available. If you want more customization, use the custom app display and app update methods described above.

Outlast Web & Mobile Development (c) 2023 | Privacy Policy |