Manual:Hooks/AuthChangeFormFields/de-formal
AuthChangeFormFields | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> 폼 AuthManager- 을 본따서 폼을 만드는 것을 허용 합니다. | |
<translate> Define function:</translate> | public static function onAuthChangeFormFields( $requests, $fieldInfo, &$formDescriptor, $action ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"AuthChangeFormFields": "MediaWiki\\Extension\\MyExtension\\Hooks::onAuthChangeFormFields"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> specialpage/AuthManagerSpecialPage.php |
<translate> Interface:</translate> | AuthChangeFormFieldsHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:AuthChangeFormFields extensions/de-formal</tvar>.</translate>
상세 항목
$requests
- AuthenticationRequests 의 나열되어 있는 항목들을 만들때 원본이 된 것은$fieldInfo
- 항목 정보 목록 (AuthenticationRequest::getFieldInfo()
에 대한 모든 것의 모음).&$formDescriptor
- HTMLForm 내용설명 입니다. 특별키weight
에 설정을 넣어 두면 항목들이 지적되는 순서를 변경할 수 있습니다.$action
-AuthManager::ACTION_*
의 설정값 종류의 어떤 것 입니다.
$formDescriptor
에 HTMLForm 을 정의(만들게)하는 내용이 들어 있을 겁니다(폼을 설명하는 것들 HTMLForm 생성자에게 전달 되려는 것); 돌발 처리(the hook) 는 보통의 진행 과정에 갑자기 변경을 가할 수 있게 합니다.
The form field names (array keys) will match the field names in the requests.
$fieldInfo
is the result of AuthenticationRequest::mergeFieldInfo( $requests )
.
Caveats:
- Changing the requests is not allowed.
- Adding fields which take data is not allowed (adding info fields is fine). Use an authentication provider's
getAuthenticationRequests()
method to add new fields. - Any validation, permission check or other business logic in the hook can be trivially circumvented by using the API. Business logic should be in the providers.
- Any vital information must be made available via the API as well. If it's for users (e.g. the text of a CAPTCHA) use a
null
field inAuthenticationRequest::getFieldInfo()
(which can be hidden/changed for the web UI from this hook if needed). If it's for machines (e.g. the public API key for the CAPTCHA) useAuthenticationRequest::getMetadata()
.
The hook is primarily meant to enhance fields defined by a provider in the same extension (e.g. change a textfield into a typeahead or other interactive widget), change the position of the widget and provide help links or other extra information. Changing form fields belonging to core or other extensions is allowed but should preferably be avoided as it makes the code more fragile.