Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hooks: Add HookDocumentAction, HookDocumentItemAction classes.
- Loading branch information
Showing
7 changed files
with
98 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* For licensing terms, see /license.txt */ | ||
|
||
class HookDocumentAction extends HookEvent implements HookDocumentActionEventInterface | ||
{ | ||
protected function __construct() | ||
{ | ||
parent::__construct('HookDocumentAction'); | ||
} | ||
|
||
/** | ||
* Update all the observers. | ||
* | ||
* @param int $type | ||
* | ||
* @return array | ||
*/ | ||
public function notifyDocumentAction($type) | ||
{ | ||
$this->eventData['type'] = $type; | ||
|
||
/** @var HookDocumentActionEventInterface $observer */ | ||
foreach ($this->observers as $observer) { | ||
$data = $observer->notifyDocumentAction($this); | ||
$this->setEventData($data); | ||
} | ||
|
||
return $this->eventData; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* For licensing terms, see /license.txt */ | ||
|
||
class HookDocumentItemAction extends HookEvent implements HookDocumentItemActionEventInterface | ||
{ | ||
protected function __construct() | ||
{ | ||
parent::__construct('HookDocumentItemAction'); | ||
} | ||
|
||
/** | ||
* Update all the observers. | ||
* | ||
* @param int $type | ||
* | ||
* @return array | ||
*/ | ||
public function notifyDocumentItemAction($type) | ||
{ | ||
$this->eventData['type'] = $type; | ||
|
||
/** @var HookDocumentItemActionEventInterface $observer */ | ||
foreach ($this->observers as $observer) { | ||
$data = $observer->notifyDocumentItemAction($this); | ||
$this->setEventData($data); | ||
} | ||
|
||
return $this->eventData; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
main/inc/lib/hook/interfaces/HookDocumentActionEventInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
/* For licensing terms, see /license.txt */ | ||
|
||
interface HookDocumentActionEventInterface extends HookEventInterface | ||
{ | ||
public function notifyDocumentAction($type); | ||
} |
8 changes: 8 additions & 0 deletions
8
main/inc/lib/hook/interfaces/HookDocumentItemActionEventInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
/* For licensing terms, see /license.txt */ | ||
|
||
interface HookDocumentItemActionEventInterface extends HookEventInterface | ||
{ | ||
public function notifyDocumentItemAction($type); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters