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 | object | $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().
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()
object
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().
static Config_ForClass
config()
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
mixed
stat(string $name)
deprecated
deprecated
Get inherited config value
mixed
uninherited(string $name)
Gets the uninherited value for the given config option
$this
set_stat(string $name, mixed $value)
deprecated
deprecated
Update the config value for a given property
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