class WorkflowEmbargoExpiryExtension extends Extension (View source)

Adds embargo period and expiry dates to content items

Properties

protected T $owner

The object this extension is applied to.

from  Extension
protected WorkflowService $workflowService
public bool $isWorkflowInEffect

Is a workflow in effect?

public static array $extendedMethodReturn

A basic extended validation routine method return format

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.

protected
updateCMSFields(FieldList $fields)

No description

public
clearPublishJob()

Clears any existing publish job against this dataobject

public
clearUnPublishJob()

Clears any existing unpublish job

protected
ensurePublishJob(int $when)

Ensure the existence of a publish job at the specified time

protected
ensureUnPublishJob(int $when)

Ensure the existence of an unpublish job at the specified time

protected
onBeforeDuplicate($original, $doWrite)

No description

protected
onBeforeWrite()

{PublishItemWorkflowAction} for approval of requested publish dates

protected
updateStatusFlags($flags)

Add badges to the site tree view to show that a page has been scheduled for publishing or unpublishing

public
array
getIntroMessageParts(string $key)

Define an array of message-parts for use by getIntroMessage()

public
string
getIntroMessage(string $key)

Display some messages to the user, a little more complex that a simple one-liner

protected
void
updateCMSCompositeValidator(CompositeValidator $validator)

No description

public
array
extendedRequiredFieldsEmbargoExpiry($data)

This is called in the AWRequiredFieldsValidator class, this validates whether an Embargo and Expiry are not equal and that Embargo is before Expiry, returning the appropriate message when it fails.

public
string
getUserDate(string $date)

Format a date according to member/user preferences

public
setIsWorkflowInEffect()

No description

public
getIsWorkflowInEffect()

No description

public
bool
getIsPublishScheduled()

Returns whether a publishing date has been set and is after the current date

public
bool
getIsUnPublishScheduled()

Returns whether an unpublishing date has been set and is after the current date

protected
bool|null
canEdit(Member $member)

Add edit check for when publishing has been scheduled and if any workflow definitions want the item to be disabled.

public
$this
setWorkflowService(WorkflowService $workflowService)

Set the workflow service instance

public
getWorkflowService()

Get the workflow service instance

PublishJob()

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

protected updateCMSFields(FieldList $fields)

No description

Parameters

FieldList $fields

clearPublishJob()

Clears any existing publish job against this dataobject

clearUnPublishJob()

Clears any existing unpublish job

protected ensurePublishJob(int $when)

Ensure the existence of a publish job at the specified time

Parameters

int $when

Timestamp to start this job, or null to start immediately

protected ensureUnPublishJob(int $when)

Ensure the existence of an unpublish job at the specified time

Parameters

int $when

Timestamp to start this job, or null to start immediately

protected onBeforeDuplicate($original, $doWrite)

No description

Parameters

$original
$doWrite

protected onBeforeWrite()

{PublishItemWorkflowAction} for approval of requested publish dates

protected updateStatusFlags($flags)

Add badges to the site tree view to show that a page has been scheduled for publishing or unpublishing

Parameters

$flags

array getIntroMessageParts(string $key)

Define an array of message-parts for use by getIntroMessage()

Parameters

string $key

Return Value

array

string getIntroMessage(string $key)

Display some messages to the user, a little more complex that a simple one-liner

Parameters

string $key

Return Value

string

protected void updateCMSCompositeValidator(CompositeValidator $validator)

No description

Parameters

CompositeValidator $validator

Return Value

void

array extendedRequiredFieldsEmbargoExpiry($data)

This is called in the AWRequiredFieldsValidator class, this validates whether an Embargo and Expiry are not equal and that Embargo is before Expiry, returning the appropriate message when it fails.

Parameters

$data

Return Value

array

string getUserDate(string $date)

Format a date according to member/user preferences

Parameters

string $date

Return Value

string $date

setIsWorkflowInEffect()

No description

getIsWorkflowInEffect()

No description

bool getIsPublishScheduled()

Returns whether a publishing date has been set and is after the current date

Return Value

bool

bool getIsUnPublishScheduled()

Returns whether an unpublishing date has been set and is after the current date

Return Value

bool

protected bool|null canEdit(Member $member)

Add edit check for when publishing has been scheduled and if any workflow definitions want the item to be disabled.

Parameters

Member $member

Return Value

bool|null

$this setWorkflowService(WorkflowService $workflowService)

Set the workflow service instance

Parameters

WorkflowService $workflowService

Return Value

$this

WorkflowService getWorkflowService()

Get the workflow service instance

Return Value

WorkflowService

QueuedJobDescriptor PublishJob()

No description

Return Value

QueuedJobDescriptor

QueuedJobDescriptor UnPublishJob()

No description

Return Value

QueuedJobDescriptor