X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FAction.php;h=51922251c00c0c00b84d7a2ba64c51733ce77a74;hb=29719f846b8887e1190ddf85125387c079f9539b;hp=a25e8aa9ab3698a894f63535d6b6007cbd723044;hpb=37b46ae357fcb7a382d5f67a9682763739483a87;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Action.php b/includes/Action.php index a25e8aa9ab..51922251c0 100644 --- a/includes/Action.php +++ b/includes/Action.php @@ -1,15 +1,6 @@ getName() ) ); + return $this->msg( strtolower( $this->getName() ) )->escaped(); } /** @@ -352,6 +359,9 @@ abstract class Action { public abstract function execute(); } +/** + * An action which shows a form and does something based on the input from the form + */ abstract class FormAction extends Action { /** @@ -387,7 +397,7 @@ abstract class FormAction extends Action { // Give hooks a chance to alter the form, adding extra fields or text etc wfRunHooks( 'ActionModifyFormFields', array( $this->getName(), &$this->fields, $this->page ) ); - $form = new HTMLForm( $this->fields, $this->getContext() ); + $form = new HTMLForm( $this->fields, $this->getContext(), $this->getName() ); $form->setSubmitCallback( array( $this, 'onSubmit' ) ); // Retain query parameters (uselang etc) @@ -446,8 +456,8 @@ abstract class FormAction extends Action { /** * @see Action::execute() * @throws ErrorPageError - * @param array|null $data - * @param bool $captureErrors + * @param $data array|null + * @param $captureErrors bool * @return bool */ public function execute( array $data = null, $captureErrors = true ) { @@ -488,9 +498,7 @@ abstract class FormAction extends Action { } /** - * Actions generally fall into two groups: the show-a-form-then-do-something-with-the-input - * format (protect, delete, move, etc), and the just-do-something format (watch, rollback, - * patrol, etc). + * An action which just does something, without showing a form first. */ abstract class FormlessAction extends Action { @@ -509,10 +517,17 @@ abstract class FormlessAction extends Action { return false; } + /** + * @param $data Array + * @return bool + */ public function onSubmit( $data ) { return false; } + /** + * @return bool + */ public function onSuccess() { return false; }