Wireframe contains a number of configuration settings that you can optionally override using site config (/site/config.php). Here are the default configuration settings:
// default config settings; if you need to customize or override any of // these, copy this array to /site/config.php as $config->wireframe $config_defaults = [ 'include_paths' => [ // '/path/to/shared/libraries/', ], 'redirect_fields' => [ // 'redirect_to_url', // 'redirect_to_page' => [ // 'property' => 'url', // 'permanent' => true, // ], ], 'allow_get_view' => false, // 'allow_get_view' => [ // 'home' => [ // 'json', // 'rss', // ], // 'json', // ], // 'view_namespaces' => [ // 'sublayouts' => $this->wire('config')->paths->templates . 'sublayouts/', // ], 'paths' => [ 'lib' => $this->wire('config')->paths->templates . "lib/", 'views' => $this->wire('config')->paths->templates . "views/", 'layouts' => $this->wire('config')->paths->templates . "layouts/", 'partials' => $this->wire('config')->paths->templates . "partials/", 'components' => $this->wire('config')->paths->templates . "components/", 'controllers' => $this->wire('config')->paths->templates . "controllers/", ], 'global_config_paths' => [ // 'lib', // 'views', // 'layouts', 'partials', // 'components', // 'controllers', ], 'urls' => [ 'dist' => $this->wire('config')->urls->assets . "dist/", 'resources' => $this->wire('config')->urls->templates . "resources/", ], ];
To override one or more settings, you should define a "wireframe" config option, containing an array of overrides:
$config->wireframe = [ 'include_paths' => [ '/var/www/common-php-snippets/', ], 'allow_get_view' => false, ];
Below you'll find detailed explanations for each individual config setting.
Any custom include path you'd like to provide to PHP.
These get passed to PHP's own set_include_path() function. For an example if you have common PHP libraries or snippets lying around in some directory, you could add that here and then refer to those using
Typical include path warnings apply here – i.e. if you're referring to a filename with relative path, you should be certain that it can't unintentionally refer to a wrong file.
Wireframe has built-in support for redirecting requests for a page to another page or URL if a redirect field is found.
Redirect fields can be defined either as field name, such as "redirect_to_url", or an array, in which case the array key is the field, and additional options include "property" (if this is defined, the field is considered to return an object with this property), and "permanent", which defines whether to use a permanent (301) redirect, or a temporary one (302).
For an example if you have a text or URL field called "redirect_to_url", adding it to the redirect_fields config array will result in an immediate redirect to the contained URL when page is rendered. If the field is blank for current page, there's no redirect.
This defines whether the view can be defined using a GET parameter. If set to boolean true, all views can be selected using GET params, but for more control an array can be used to define a whitelist of allowed views (globally, or for specific templates).
For an example: if allow_get_view is enabled and your "home" template has two views, "default" (/site/templates/views/home/default.php), and "rss" (/site/templates/views/home/rss.php), and your home page is accessed with GET param
?view=rss, the page will be rendered using the "rss" view.
This feature is useful for defining custom views for pages, but it is recommended that you define allowed views using a whitelist instead of whitelisting everything with boolean "true".
Note that when a page is accessed using this parameter, caching is automatically disabled for that request. This is done to avoid unintentionally caching an alternative view as the default one.
This setting is used to define available view namespaces. For a more in-depth explanation, please visit the view namespaces documentation page.
paths (array), urls (array)
These two settings are used to define Wireframe paths and URLs. Usually it's a good idea to leave these as-is, unless there's a conflict with existing directories, or for some other reason you really need to modify your directory structure.
This setting defines which Wireframe paths are made available via ProcessWire's
$config->paths object. By default only the partials path is available, mainly to avoid "polluting" the global config with anything that isn't strictly necessary.