Skip to content

Commit

Permalink
Merge pull request #531 from creative-commoners/pulls/7/protect-hooks
Browse files Browse the repository at this point in the history
API Set extension hook implementation visibility to protected
  • Loading branch information
GuySartorelli authored May 21, 2024
2 parents 6cf3faa + e2e7dc1 commit f67e0b6
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/DataObjects/WorkflowAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function execute(WorkflowInstance $workflow)
return true;
}

public function onBeforeWrite()
protected function onBeforeWrite()
{
if (!$this->Sort) {
$this->Sort = DB::query('SELECT MAX("Sort") + 1 FROM "WorkflowAction"')->value();
Expand All @@ -199,7 +199,7 @@ public function onBeforeWrite()
* are deleted
* Also removes all outbound transitions
*/
public function onAfterDelete()
protected function onAfterDelete()
{
parent::onAfterDelete();
$wfActionInstances = WorkflowActionInstance::get()
Expand Down
6 changes: 3 additions & 3 deletions src/DataObjects/WorkflowDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function getInitialAction()
/**
* Ensure a sort value is set and we get a useable initial workflow title.
*/
public function onBeforeWrite()
protected function onBeforeWrite()
{
if (!$this->Sort) {
$this->Sort = DB::query('SELECT MAX("Sort") + 1 FROM "WorkflowDefinition"')->value();
Expand All @@ -137,7 +137,7 @@ public function onBeforeWrite()
* After we've been written, check whether we've got a template and to then
* create the relevant actions etc.
*/
public function onAfterWrite()
protected function onAfterWrite()
{
parent::onAfterWrite();

Expand All @@ -158,7 +158,7 @@ public function onAfterWrite()
*
* @return null
*/
public function onBeforeDelete()
protected function onBeforeDelete()
{
parent::onBeforeDelete();

Expand Down
2 changes: 1 addition & 1 deletion src/DataObjects/WorkflowInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function fieldLabels($includerelations = true)
/**
* See if we've been saved in context of managing the workflow directly
*/
public function onBeforeWrite()
protected function onBeforeWrite()
{
parent::onBeforeWrite();

Expand Down
2 changes: 1 addition & 1 deletion src/DataObjects/WorkflowTransition.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function isValid(WorkflowInstance $workflow)
/**
* Before saving, make sure we're not in an infinite loop
*/
public function onBeforeWrite()
protected function onBeforeWrite()
{
if (!$this->Sort) {
$this->Sort = DB::query('SELECT MAX("Sort") + 1 FROM "WorkflowTransition"')->value();
Expand Down
2 changes: 1 addition & 1 deletion src/Extensions/AdvancedWorkflowExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function updateEditForm(Form $form)
/**
* @param Form $form
*/
public function updateItemEditForm($form)
protected function updateItemEditForm($form)
{
/** @var DataObject $record */
$record = $form->getRecord();
Expand Down
6 changes: 3 additions & 3 deletions src/Extensions/FileWorkflowApplicable.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
*/
class FileWorkflowApplicable extends WorkflowApplicable
{
public function updateSummaryFields(&$fields)
protected function updateSummaryFields(&$fields)
{
$fields['ID'] = 'ID';
$fields['ParentID'] = 'ParentID';
}

public function updateCMSFields(FieldList $fields)
protected function updateCMSFields(FieldList $fields)
{
if (!$this->owner->ID) {
return $fields;
Expand All @@ -49,7 +49,7 @@ public function updateCMSFields(FieldList $fields)
}
}

public function onAfterWrite()
protected function onAfterWrite()
{
parent::onAfterWrite();

Expand Down
8 changes: 4 additions & 4 deletions src/Extensions/WorkflowApplicable.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ public function isPublishJobRunning()
*/
protected $currentInstance;

public function updateSettingsFields(FieldList $fields)
protected function updateSettingsFields(FieldList $fields)
{
$this->updateFields($fields);
}

public function updateCMSFields(FieldList $fields)
protected function updateCMSFields(FieldList $fields)
{
if (!$this->owner->hasMethod('getSettingsFields')) {
$this->updateFields($fields);
Expand Down Expand Up @@ -184,7 +184,7 @@ public function updateFields(FieldList $fields)
}
}

public function updateCMSActions(FieldList $actions)
protected function updateCMSActions(FieldList $actions)
{
$active = $this->getWorkflowService()->getWorkflowFor($this->owner);
$c = Controller::curr();
Expand Down Expand Up @@ -325,7 +325,7 @@ public function LinkToPendingItems()
* After a workflow item is written, we notify the
* workflow so that it can take action if needbe
*/
public function onAfterWrite()
protected function onAfterWrite()
{
$instance = $this->getWorkflowInstance();
if ($instance && $instance->CurrentActionID) {
Expand Down
8 changes: 4 additions & 4 deletions src/Extensions/WorkflowEmbargoExpiryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class WorkflowEmbargoExpiryExtension extends DataExtension
/**
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
protected function updateCMSFields(FieldList $fields)
{
// requirements
// ------------
Expand Down Expand Up @@ -246,7 +246,7 @@ protected function ensureUnPublishJob($when)
->queueJob($job, $when ? date('Y-m-d H:i:s', $when) : null);
}

public function onBeforeDuplicate($original, $doWrite)
protected function onBeforeDuplicate($original, $doWrite)
{
$clone = $this->owner;

Expand All @@ -259,7 +259,7 @@ public function onBeforeDuplicate($original, $doWrite)
/**
* {@see PublishItemWorkflowAction} for approval of requested publish dates
*/
public function onBeforeWrite()
protected function onBeforeWrite()
{
parent::onBeforeWrite();

Expand Down Expand Up @@ -341,7 +341,7 @@ public function onBeforeWrite()
*
* @param $flags
*/
public function updateStatusFlags(&$flags)
protected function updateStatusFlags(&$flags)
{
$embargo = $this->getIsPublishScheduled();
$expiry = $this->getIsUnPublishScheduled();
Expand Down

0 comments on commit f67e0b6

Please sign in to comment.