class FluentGridFieldExtension extends Extension (View source)

Supports GridFieldDetailForm_ItemRequest with extra actions

Traits

Decorates admin areas for localised items with extra actions.

Properties

protected T $owner

The object this extension is applied to.

from  Extension

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(object $owner)

Set the owner of this extension.

public
mixed
withOwner(mixed $owner, callable $callback, array $args = [])

Temporarily modify the owner. The original owner is ensured to be restored

public
clearOwner()

Clear the current owner, and restore extension to the state prior to the last setOwner()

public
T
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 that's passed to DataObject::$extensions or Object::add_extension().

public
mixed
invokeExtension(object $owner, string $method, array ...$arguments)

Invoke extension point. This will prefer explicit extend prefixed methods.

public
actionComplete(Form $form, string $message)

No description

protected
updateFluentActions(FieldList $actions, DataObject $record)

Decorate actions with fluent-specific details

public
mixed
clearFluent(array $data, Form $form)

No description

public
mixed
copyFluent(array $data, Form $form)

Copy this record to other localisations (not published)

public
mixed
unpublishFluent(array $data, Form $form)

Unpublishes the current object from all locales

public
mixed
archiveFluent(array $data, Form $form)

Archives the current object from all locales (versioned)

public
mixed
deleteFluent(array $data, Form $form)

Delete the current object from all locales (non-versioned)

public
mixed
publishFluent(array $data, Form $form)

No description

public
mixed
showFluent(array $data, Form $form)

No description

public
mixed
hideFluent(array $data, Form $form)

No description

protected
inEveryLocale(callable $doSomething)

Do an action in every locale

protected
inEveryStage(callable $doSomething)

Do an action in every stage (Live first)

protected
void
updateSaveAction(FieldList $actions, DataObject $record)

Update save action based on localisation state valid states:

  • localised (localise label)
  • not localised (save label)

protected
void
updateDeleteAction(FieldList $actions, DataObject $record)

Update delete action based on localisation state valid states:

  • localised more than one locale (unlocalise label)
  • localised in one locale (delete label)
  • not localised (remove the action)

protected
void
updateInformationPanel(FieldList $actions, DataObject $record)

Information panel shows published state of a base record by default this overrides the display with the published state of the localised record

protected
DBField|null
addFluentBadge(DBField|null $badgeField, DataObject $record)

Add the Fluent state badge before any existing badges and return the result

public
DBField|null
getBadge(DataObject $record)

Given a record with Fluent enabled, return a badge that represents the state of it in the current locale

protected
string
generateBadgeHTML(DataObject $record, Locale $locale, array $extraProperties = [])

No description

public
updateBadge(DBField|null $badgeField)

Push a badge to indicate the language that owns the current item

public
updateFormActions(FieldList $actions)

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(object $owner)

Set the owner of this extension.

Parameters

object $owner

The owner object

mixed withOwner(mixed $owner, callable $callback, array $args = [])

Temporarily modify the owner. The original owner is ensured to be restored

Parameters

mixed $owner

Owner to set

callable $callback

Callback to invoke

array $args

Args to pass to callback

Return Value

mixed

clearOwner()

Clear the current owner, and restore extension to the state prior to the last setOwner()

T getOwner()

Returns the owner of this extension.

Return Value

T

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().

Parameters

string $extensionStr

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

Return Value

string

Extension classname, e.g. "Versioned"

mixed invokeExtension(object $owner, string $method, array ...$arguments)

Invoke extension point. This will prefer explicit extend prefixed methods.

Parameters

object $owner
string $method
array ...$arguments

Return Value

mixed

HTTPResponse|string|DBHTMLText actionComplete(Form $form, string $message)

No description

Parameters

Form $form
string $message

Return Value

HTTPResponse|string|DBHTMLText

protected updateFluentActions(FieldList $actions, DataObject $record)

Decorate actions with fluent-specific details

Parameters

FieldList $actions
DataObject $record

mixed clearFluent(array $data, Form $form)

No description

Parameters

array $data
Form $form

Return Value

mixed

Exceptions

HTTPResponse_Exception

mixed copyFluent(array $data, Form $form)

Copy this record to other localisations (not published)

Parameters

array $data
Form $form

Return Value

mixed

Exceptions

HTTPResponse_Exception

mixed unpublishFluent(array $data, Form $form)

Unpublishes the current object from all locales

Parameters

array $data
Form $form

Return Value

mixed

Exceptions

HTTPResponse_Exception

mixed archiveFluent(array $data, Form $form)

Archives the current object from all locales (versioned)

Parameters

array $data
Form $form

Return Value

mixed

Exceptions

HTTPResponse_Exception

mixed deleteFluent(array $data, Form $form)

Delete the current object from all locales (non-versioned)

Parameters

array $data
Form $form

Return Value

mixed

Exceptions

HTTPResponse_Exception

mixed publishFluent(array $data, Form $form)

No description

Parameters

array $data
Form $form

Return Value

mixed

Exceptions

ValidationException
HTTPResponse_Exception

mixed showFluent(array $data, Form $form)

No description

Parameters

array $data
Form $form

Return Value

mixed

Exceptions

HTTPResponse_Exception

mixed hideFluent(array $data, Form $form)

No description

Parameters

array $data
Form $form

Return Value

mixed

Exceptions

HTTPResponse_Exception

protected inEveryLocale(callable $doSomething)

Do an action in every locale

Parameters

callable $doSomething

protected inEveryStage(callable $doSomething)

Do an action in every stage (Live first)

Parameters

callable $doSomething

protected void updateSaveAction(FieldList $actions, DataObject $record)

Update save action based on localisation state valid states:

  • localised (localise label)
  • not localised (save label)

Parameters

FieldList $actions
DataObject $record

Return Value

void

protected void updateDeleteAction(FieldList $actions, DataObject $record)

Update delete action based on localisation state valid states:

  • localised more than one locale (unlocalise label)
  • localised in one locale (delete label)
  • not localised (remove the action)

Parameters

FieldList $actions
DataObject $record

Return Value

void

protected void updateInformationPanel(FieldList $actions, DataObject $record)

Information panel shows published state of a base record by default this overrides the display with the published state of the localised record

Parameters

FieldList $actions
DataObject $record

Return Value

void

protected DBField|null addFluentBadge(DBField|null $badgeField, DataObject $record)

Add the Fluent state badge before any existing badges and return the result

Parameters

DBField|null $badgeField

Existing badge to merge with

DataObject $record

Return Value

DBField|null

DBField|null getBadge(DataObject $record)

Given a record with Fluent enabled, return a badge that represents the state of it in the current locale

Parameters

DataObject $record

Return Value

DBField|null

protected string generateBadgeHTML(DataObject $record, Locale $locale, array $extraProperties = [])

No description

Parameters

DataObject $record
Locale $locale
array $extraProperties

Return Value

string

updateBadge(DBField|null $badgeField)

Push a badge to indicate the language that owns the current item

Parameters

DBField|null $badgeField

See also

VersionedGridFieldItemRequest::Breadcrumbs

updateFormActions(FieldList $actions)

No description

Parameters

FieldList $actions