2022-03-08 15:55:41 +01:00
|
|
|
<?php namespace ProcessWire;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PageAction
|
|
|
|
*
|
|
|
|
* Base class for Page actions in ProcessWire
|
|
|
|
*
|
|
|
|
* This file is licensed under the MIT license
|
|
|
|
* https://processwire.com/about/license/mit/
|
2023-03-10 19:41:40 +01:00
|
|
|
*
|
|
|
|
* @method bool action(Page $item)
|
|
|
|
* @method executeMultiple(PageArray $items)
|
2022-03-08 15:55:41 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
abstract class PageAction extends WireAction implements Module {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return array of module information
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*
|
|
|
|
public static function getModuleInfo() {
|
|
|
|
return array(
|
|
|
|
'title' => 'PageAction (abstract)',
|
|
|
|
'summary' => 'Base class for PageActions',
|
|
|
|
'version' => 0
|
|
|
|
);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the string type (class name) of items that this action operates upon
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function getItemType() {
|
|
|
|
return strlen(__NAMESPACE__) ? __NAMESPACE__ . '\\Page' : 'Page';
|
|
|
|
}
|
|
|
|
|
2023-03-10 19:41:40 +01:00
|
|
|
/**
|
|
|
|
* Execute the action for the given page
|
|
|
|
*
|
|
|
|
* @param Page $item Item to operate upon
|
|
|
|
* @return bool True if the item was successfully operated upon, false if not.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function execute($item) {
|
|
|
|
return parent::execute($item);
|
|
|
|
}
|
|
|
|
|
2022-03-08 15:55:41 +01:00
|
|
|
/**
|
|
|
|
* Perform the action on the given item
|
|
|
|
*
|
|
|
|
* @param Page $item Page item to operate upon
|
|
|
|
* @return bool True if the item was successfully operated upon, false if not.
|
|
|
|
*
|
|
|
|
abstract protected function ___action($item);
|
|
|
|
*/
|
|
|
|
}
|