class FluentSiteTree extends FluentExtension (View source)

SiteTree extension class for translatable objects

Properties

protected SS_Object $owner

The object this extension is applied to.

from  Extension
protected DataObject $ownerBaseClass

The base class that this extension was applied to; $this->owner must be one of these

from  Extension
public $class from  Extension
protected static bool $disable_fluent_fields

Hook allowing temporary disabling of extra fluent fields

from  FluentExtension
protected static array $translated_fields_for_cache

Cache for list of translated fields for all inspected classes

from  FluentExtension
protected static $_enable_write_augmentation from  FluentExtension

Methods

public
__construct()

No description

public static 
add_to_class(string $class, string $extensionClass, mixed $args = null)

Called when this extension is added to a particular class

public
setOwner(SS_Object $owner, string $ownerBaseClass = null)

Set the owner of this extension.

public
clearOwner()

No description

public
getOwner()

Returns the owner of this extension.

public static 
string
get_classname_without_arguments(string $extensionStr)

Helper method to strip eval'ed arguments from a string thats passed to DataObject::$extensions or Object::add_extension().

public static 
get_extra_config($class, $extension, $args)

No description

public static 
unload_extra_statics($class, $extension)

No description

public
validate(ValidationResult $validationResult)

Hook for extension-specific validation.

public
augmentSQL(SQLQuery $query, DataQuery $dataQuery = null)

Edit the given query object to support queries for this extension

public
augmentDatabase()

Update the database schema as required by this extension.

public
augmentWrite(array $manipulation)

Augment a write-record request.

public
onBeforeWrite()

No description

public
onAfterWrite()

No description

public
onBeforeDelete()

No description

public
onAfterDelete()

No description

public
requireDefaultRecords()

No description

public
populateDefaults()

No description

public
can($member)

No description

public
canEdit($member)

No description

public
canDelete($member)

No description

public
canCreate($member)

No description

public
array
extraStatics($class = null, $extension = null)

Define extra database fields

public
updateCMSFields(FieldList $fields)

No description

public
updateFrontEndFields(FieldList $fields)

This function is used to provide modifications to the form used for front end forms. DataObject->getFrontEndFields()

public
updateCMSActions(FieldList $actions)

This is used to provide modifications to the form actions used in the CMS. DataObject->getCMSActions().

public
updateSummaryFields(array $fields)

this function is used to provide modifications to the summary fields in CMS by the extension By default, the summaryField() of its owner will merge more fields defined in the extension's $extra_fields['summary_fields']

public
updateFieldLabels(array $labels)

this function is used to provide modifications to the fields labels in CMS by the extension By default, the fieldLabels() of its owner will merge more fields defined in the extension's $extra_fields['field_labels']

protected static 
mixed
without_fluent_fields(callable $callback)

Executes a callback with extra fluent fields disabled

public static 
array
translated_fields_for($class)

Determines the fields to translate on the given class

public static 
base_indexes($class)

No description

protected
array
getTranslatedTables()

Get all database tables in the class ancestry and their respective translatable fields

protected static 
array
explode_column_string(string $spec)

Splits a spec string safely, considering quoted columns, whitespace, and cleaning brackets

protected static 
string
implode_column_list(array $columns)

Builds a properly quoted column list from an array

protected static 
string
quote_column_spec_string(string $spec)

Given an index specification in the form of a string ensure that each column name is property quoted, stripping brackets and modifiers.

protected static 
string
determine_index_type(type $spec)

Given an index spec determines the index type

protected static 
array
parse_index_spec($name, string|array $spec)

Converts an array or string index spec into a universally useful array

public static 
generate_extra_config(string $class)

Generates the extra DB fields for a class (not including subclasses)

public
Locales()

Templatable list of all locales

public
string
LocaleLink(string $locale)

Determine the link to this object given the specified $locale.

public
string
BaseURLForLocale(string $locale = null)

Determine the baseurl within a specified $locale.

public
LocaleInformation(string $locale = null)

Retrieves information about this object in the specified locale

public
string
CurrentLocale()

Current locale code

public
augmentDataQueryCreation(SQLQuery $query, DataQuery $dataQuery)

Amend freshly created DataQuery objects with the current locale and frontend status

public static 
set_enable_write_augmentation($enabled)

No description

protected
array
detectFilterColumn(string $condition, array $includedTables)

Determines the table/column identifier that first appears in the $condition, and returns the localised version of that column.

protected
string
localiseFilterCondition(string $condition, array $includedTables, string $locale)

Replaces all columns in the given condition with any localised

protected
string
localiseSelect(string $class, string $select, string $fallback)

Generates a select fragment based on a field with a fallback

public
bool
isFieldNullable(string $field)

Can this field be left empty?

protected
$this
addLocaleIndicatorMessage(FieldList $fields)

Adds a UI message to indicate whether you're editing in the default locale or not

public
MetaTags($tags)

No description

public
contentcontrollerInit(ContentController $controller)

Ensure that the controller is correctly initialised

public
updateRelativeLink($base, $action)

No description

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

Parameters

string $class
string $extensionClass
mixed $args

setOwner(SS_Object $owner, string $ownerBaseClass = null)

Set the owner of this extension.

Parameters

SS_Object $owner

The owner object,

string $ownerBaseClass

The base class that the extension is applied to; this may be the class of owner, or it may be a parent. For example, if Versioned was applied to SiteTree, and then a Page object was instantiated, $owner would be a Page object, but $ownerBaseClass would be 'SiteTree'.

clearOwner()

No description

SS_Object getOwner()

Returns the owner of this extension.

Return Value

SS_Object

static string get_classname_without_arguments(string $extensionStr)

Helper method to strip eval'ed arguments from a string thats passed to DataObject::$extensions or Object::add_extension().

Parameters

string $extensionStr

E.g. "Versioned('Stage','Live')"

Return Value

string

Extension classname, e.g. "Versioned"

static get_extra_config($class, $extension, $args)

No description

Parameters

$class
$extension
$args

static unload_extra_statics($class, $extension)

No description

Parameters

$class
$extension

validate(ValidationResult $validationResult)

Hook for extension-specific validation.

Parameters

ValidationResult $validationResult

Local validation result

Exceptions

ValidationException

augmentSQL(SQLQuery $query, DataQuery $dataQuery = null)

Edit the given query object to support queries for this extension

Parameters

SQLQuery $query

Query to augment.

DataQuery $dataQuery

augmentDatabase()

Update the database schema as required by this extension.

When duplicating a table's structure, remember to duplicate the create options as well. See Versioned->augmentDatabase for an example.

augmentWrite(array $manipulation)

Augment a write-record request.

Parameters

array $manipulation

Array of operations to augment.

onBeforeWrite()

No description

onAfterWrite()

No description

onBeforeDelete()

No description

onAfterDelete()

No description

requireDefaultRecords()

No description

populateDefaults()

No description

can($member)

No description

Parameters

$member

canEdit($member)

No description

Parameters

$member

canDelete($member)

No description

Parameters

$member

canCreate($member)

No description

Parameters

$member

array extraStatics($class = null, $extension = null)

Define extra database fields

Return a map where the keys are db, has_one, etc, and the values are additional fields/relations to be defined.

Parameters

$class

since this method might be called on the class directly

$extension

since this can help to extract parameters to help set indexes

Return Value

array

Returns a map where the keys are db, has_one, etc, and the values are additional fields/relations to be defined.

updateCMSFields(FieldList $fields)

No description

Parameters

FieldList $fields

FieldList with a contained TabSet

updateFrontEndFields(FieldList $fields)

This function is used to provide modifications to the form used for front end forms. DataObject->getFrontEndFields()

Caution: Use FieldList->push() to add fields.

Parameters

FieldList $fields

FieldList without TabSet nesting

updateCMSActions(FieldList $actions)

This is used to provide modifications to the form actions used in the CMS. DataObject->getCMSActions().

Parameters

FieldList $actions FieldList

updateSummaryFields(array $fields)

this function is used to provide modifications to the summary fields in CMS by the extension By default, the summaryField() of its owner will merge more fields defined in the extension's $extra_fields['summary_fields']

Parameters

array $fields

Array of field names

updateFieldLabels(array $labels)

this function is used to provide modifications to the fields labels in CMS by the extension By default, the fieldLabels() of its owner will merge more fields defined in the extension's $extra_fields['field_labels']

Parameters

array $labels

Array of field labels

static protected mixed without_fluent_fields(callable $callback)

Executes a callback with extra fluent fields disabled

Parameters

callable $callback

Return Value

mixed

static array translated_fields_for($class)

Determines the fields to translate on the given class

Parameters

$class

Return Value

array

List of field names and data types

static base_indexes($class)

No description

Parameters

$class

protected array getTranslatedTables()

Get all database tables in the class ancestry and their respective translatable fields

Return Value

array

static protected array explode_column_string(string $spec)

Splits a spec string safely, considering quoted columns, whitespace, and cleaning brackets

Parameters

string $spec

The input index specification

Return Value

array

List of columns in the spec

static protected string implode_column_list(array $columns)

Builds a properly quoted column list from an array

Parameters

array $columns

List of columns to implode

Return Value

string

A properly quoted list of column names

static protected string quote_column_spec_string(string $spec)

Given an index specification in the form of a string ensure that each column name is property quoted, stripping brackets and modifiers.

This index may also be in the form of a "CREATE INDEX..." sql fragment

Parameters

string $spec

The input specification or query. E.g. 'unique (Column1, Column2)'

Return Value

string

The properly quoted column list. E.g. '"Column1", "Column2"'

static protected string determine_index_type(type $spec)

Given an index spec determines the index type

Parameters

type $spec

Return Value

string

static protected array parse_index_spec($name, string|array $spec)

Converts an array or string index spec into a universally useful array

Parameters

$name
string|array $spec

Return Value

array

The resulting spec array with the required fields name, type, and value

static generate_extra_config(string $class)

Generates the extra DB fields for a class (not including subclasses)

Parameters

string $class

ArrayList Locales()

Templatable list of all locales

Return Value

ArrayList

Determine the link to this object given the specified $locale.

Returns null for DataObjects that do not have a 'Link' function.

Parameters

string $locale

Return Value

string

string BaseURLForLocale(string $locale = null)

Determine the baseurl within a specified $locale.

Parameters

string $locale

Locale, or null to use current locale

Return Value

string

ArrayData LocaleInformation(string $locale = null)

Retrieves information about this object in the specified locale

Parameters

string $locale

The locale information to request, or null to use the default locale

Return Value

ArrayData

Mapped list of locale properties

string CurrentLocale()

Current locale code

Return Value

string

Locale code

augmentDataQueryCreation(SQLQuery $query, DataQuery $dataQuery)

Amend freshly created DataQuery objects with the current locale and frontend status

Parameters

SQLQuery $query
DataQuery $dataQuery

static set_enable_write_augmentation($enabled)

No description

Parameters

$enabled

protected array detectFilterColumn(string $condition, array $includedTables)

Determines the table/column identifier that first appears in the $condition, and returns the localised version of that column.

Parameters

string $condition

Condition SQL string

array $includedTables

Return Value

array

Array with items [$table, $column], or null if not found

protected string localiseFilterCondition(string $condition, array $includedTables, string $locale)

Replaces all columns in the given condition with any localised

Parameters

string $condition

Condition SQL string

array $includedTables
string $locale

Locale to localise to

Return Value

string

$condition parameter with column names replaced

protected string localiseSelect(string $class, string $select, string $fallback)

Generates a select fragment based on a field with a fallback

Parameters

string $class

Table/Class name

string $select

Column to select from

string $fallback

Column to fallback to if $select is empty

Return Value

string

Select fragment

bool isFieldNullable(string $field)

Can this field be left empty?

Parameters

string $field

Return Value

bool

False if the field inherits, true if it is nullable

protected $this addLocaleIndicatorMessage(FieldList $fields)

Adds a UI message to indicate whether you're editing in the default locale or not

Parameters

FieldList $fields

Return Value

$this

MetaTags($tags)

No description

Parameters

$tags

contentcontrollerInit(ContentController $controller)

Ensure that the controller is correctly initialised

Parameters

ContentController $controller

No description

Parameters

$base
$action