FluentDirectorExtension
class FluentDirectorExtension extends Extension (View source)
Fluent extension for \SilverStripe\Control\Director to apply routing rules for locales
Traits
Provides extensions to this object to integrate it with standard config API methods.
Config options
allowed_actions | This is used by extensions designed to be applied to controllers. |
from Extension | |
detect_locale | bool | Determine if the site should detect the browser locale for new users. Turn this off to disable 302 redirects on the home page. |
|
remember_locale | bool | Determine if the locale should be remembered across multiple sessions via cookies. If this is left on then visitors to the home page will be redirected to the locale they last viewed. This may interefere with some applications and can be turned off to prevent unexpected redirects. |
|
query_param | string | Request parameter to store the locale in |
|
disable_default_prefix | bool | Allow the prefix for the default Locale (IsDefault = 1) to be disabled. |
|
force_domain | bool | Whether to force "domain mode" |
Properties
protected | T | $owner | The object this extension is applied to. |
from Extension |
Methods
Called when this extension is added to a particular class
Temporarily modify the owner. The original owner is ensured to be restored
Clear the current owner, and restore extension to the state prior to the last setOwner()
Helper method to strip eval'ed arguments from a string that's passed to DataObject::$extensions or Object::add_extension().
Invoke extension point. This will prefer explicit extend
prefixed
methods.
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
Gets the uninherited value for the given config option
Generate an array of explicit routing rules for each locale
Get controller that fluent should inject
Inserts the given rule(s) before another rule
Details
__construct()
No description
static
add_to_class(string $class, string $extensionClass, mixed $args = null)
Called when this extension is added to a particular class
setOwner(object $owner)
Set the owner of this extension.
mixed
withOwner(mixed $owner, callable $callback, array $args = [])
Temporarily modify the owner. The original owner is ensured to be restored
clearOwner()
Clear the current owner, and restore extension to the state prior to the last setOwner()
T
getOwner()
Returns the owner of this extension.
static string
get_classname_without_arguments(string $extensionStr)
Helper method to strip eval'ed arguments from a string that's passed to DataObject::$extensions or Object::add_extension().
mixed
invokeExtension(object $owner, string $method, array ...$arguments)
Invoke extension point. This will prefer explicit extend
prefixed
methods.
static Config_ForClass
config()
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
mixed
uninherited(string $name)
Gets the uninherited value for the given config option
updateRules(array $rules)
Forces regeneration of all locale routes
protected array
getExplicitRoutes(array $originalRules)
Generate an array of explicit routing rules for each locale
protected string
getRuleController(array|string $existingRule, Locale $localeObj)
Get controller that fluent should inject
protected array
insertRuleBefore(array $rules, string $key, array $rule, bool $prependIfMissing = true)
Inserts the given rule(s) before another rule
protected string
encodeRoutePrefix(string $url)
Safely encode urls