Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
Field and action extension hooks added
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Morgan committed Jul 19, 2013
1 parent 0a1e9f0 commit cd4ed98
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions code/OpauthRegisterForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public function __construct($controller, $name, array $requiredFields = null) {
$this->requiredFields = $requiredFields;
}
parent::__construct($controller, $name, $this->getFields(), $this->getActions(), $this->getValidator());
// Manually call extensions here as Object must first construct extensions
$this->extend('updateFields', $this->fields);
$this->extend('updateActions', $this->actions);
}

/**
Expand All @@ -46,7 +49,9 @@ public function setRequiredFields($fields) {
* @return FieldList
*/
public function getFields() {
return $this->getFieldSource();
$fields = $this->getFieldSource();
$this->extend('updateFields', $fields);
return $fields;
}

/**
Expand Down Expand Up @@ -84,9 +89,11 @@ public static function set_field_source($sourceFn) {
* @return FieldList
*/
public function getActions() {
return new FieldList(array(
$actions = new FieldList(array(
new FormAction('doCompleteRegister', 'Complete'),
));
$results = $this->extend('updateActions', $actions);
return $actions;
}

/**
Expand Down

0 comments on commit cd4ed98

Please sign in to comment.