Skip to content

Options

Introduction

The Options API allows you to create, update, read, and delete data from the option table. Each site has it own option table with 3 fields (option_id, option_key, option_value).

Method Description Type Parameters Return
__construct public
factory throws ReflectionException
throws ContainerExceptionInterface
throws NotFoundExceptionInterface
public
static
create Add an option to the table

throws Exception
throws InvalidArgumentException
throws ReflectionException
throws TypeException
throws \Exception
public string $name
mixed $value
bool
read Read an option from options_meta


throws InvalidArgumentException
throws ReflectionException|Exception
public Return value or $default if not found
update Update (add if it doesn't exist) an option to option's table. public string $optionKey
mixed $newvalue
bool
delete Delete an option from the table. public string $name bool
massUpdate Update an array of options to the option's table. Best to validate the data array first before running this method. public array $options bool

Devflow comes with some default general and reading options:

General

  • sitename - Name of the site (default: Devflow).
  • site_description - Short description of the site (default: Just another Devflow site.).
  • admin_email - Administrator email (default: admin@devflow.com).
  • site_locale - Locale for the site (default: en).
  • cookieexpire - Cookie expiry time in seconds (default: 604800 = 1 week).
  • cookiepath - The server path for which the cookie will be available on (default: /).
  • site_timezone - Timezone for the site (default: America/Los_Angeles.
  • api_key - Api key for REST requests (default: auto generated during install).

Reading

  • charset - Encoding for content (default: UTF-8).
  • content_per_page - How many content blocks to show per page (default: 6).
  • date_format - Format for how dates should be displayed (default: d F Y).
  • time_format - Format for how times should be displayed (default: h:i A).