Permalink
Browse files

Fixed a bug that widgets became not to be updated since supporting ad…

…min-ajax.php for other factory classes.
  • Loading branch information...
michaeluno committed Jan 15, 2017
1 parent 325ab22 commit 7ce09ae4c418b11edae98a203c38aa0a2819fdd6
@@ -470,14 +470,14 @@ public function setFormProperties() {
$this->aFormCallbacks = $this->getFormCallbacks();
}
/**
- * @remark The Widget factory class access this method.
+ *
* @return array
* @since 3.7.9
*/
public function getFormArguments() {
return array(
'caller_id' => $this->sClassName,
- 'structure_type' => $this->_sPropertyType, // @todo change this to admin_page
+ 'structure_type' => $this->_sPropertyType,
'action_hook_form_registration' => $this->bIsAdminAjax
? 'admin_init' // 3.8.14
: $this->_sFormRegistrationHook,
@@ -128,5 +128,21 @@ public function __construct( $oCaller, $sCallerPath, $sClassName, $sCapability='
);
}
+
+ /**
+ * Overrides the parent method.
+ * No need to set `admin_init` to the `action_hook_form_registration` element.
+ * Otherwise, the widgets become not be updated visually, which is done in Ajax.
+ *
+ * @return array
+ * @since 3.8.14
+ */
+ public function getFormArguments() {
+ return array(
+ 'caller_id' => $this->sClassName,
+ 'structure_type' => $this->_sPropertyType,
+ 'action_hook_form_registration' => $this->_sFormRegistrationHook,
+ ) + $this->aFormArguments;
+ }
}

0 comments on commit 7ce09ae

Please sign in to comment.