1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-06 14:35:56 +02:00

[feature/oauth] Update auth provider interface docs for block vars in ACP

PHPBB3-11673
This commit is contained in:
Joseph Warner 2013-07-23 14:41:21 -04:00
parent af6a4b2161
commit 0857d14030
3 changed files with 22 additions and 4 deletions

View File

@ -660,13 +660,12 @@ class acp_board
{ {
if (array_key_exists('BLOCK_VAR_NAME', $auth_tpl)) if (array_key_exists('BLOCK_VAR_NAME', $auth_tpl))
{ {
foreach ($auth_tpl['TEMPLATE_VARS'] as $block_vars) foreach ($auth_tpl['BLOCK_VARS'] as $block_vars)
{ {
$template->assign_block_vars($auth_tpl['BLOCK_VAR_NAME'], $block_vars); $template->assign_block_vars($auth_tpl['BLOCK_VAR_NAME'], $block_vars);
} }
} else {
$template->assign_vars($auth_tpl['TEMPLATE_VARS']);
} }
$template->assign_vars($auth_tpl['TEMPLATE_VARS']);
$template->assign_block_vars('auth_tpl', array( $template->assign_block_vars('auth_tpl', array(
'TEMPLATE_FILE' => $auth_tpl['TEMPLATE_FILE'], 'TEMPLATE_FILE' => $auth_tpl['TEMPLATE_FILE'],
)); ));

View File

@ -80,6 +80,24 @@ interface phpbb_auth_provider_interface
* 'TEMPLATE_FILE' => string, * 'TEMPLATE_FILE' => string,
* 'TEMPLATE_VARS' => array(...), * 'TEMPLATE_VARS' => array(...),
* ) * )
* An optional third element may be added to this
* array: 'BLOCK_VAR_NAME'. If this is present,
* then it's value should be a string that is used
* to designate the name of the loop used in the
* ACP template file. In addition to this, an
* additional key named 'BLOCK_VARS' is required.
* This must be an array containing at least one
* array of variables that will be assigned during
* the loop in the template. An example of this is
* presented below:
* array(
* 'BLOCK_VAR_NAME' => string,
* 'BLOCK_VARS' => array(
* 'KEY IS UNIMPORTANT' => array(...),
* ),
* 'TEMPLATE_FILE' => string,
* 'TEMPLATE_VARS' => array(...),
* )
*/ */
public function get_acp_template($new_config); public function get_acp_template($new_config);

View File

@ -264,6 +264,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
{ {
$ret = array( $ret = array(
'BLOCK_VAR_NAME' => 'oauth_services', 'BLOCK_VAR_NAME' => 'oauth_services',
'BLOCK_VARS' => array(),
'TEMPLATE_FILE' => 'auth_provider_oauth.html', 'TEMPLATE_FILE' => 'auth_provider_oauth.html',
'TEMPLATE_VARS' => array(), 'TEMPLATE_VARS' => array(),
); );
@ -271,7 +272,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
foreach ($this->service_providers as $service_name => $service_provider) foreach ($this->service_providers as $service_name => $service_provider)
{ {
$actual_name = str_replace('auth.provider.oauth.service.', '', $service_name); $actual_name = str_replace('auth.provider.oauth.service.', '', $service_name);
$ret['TEMPLATE_VARS'][$actual_name] = array( $ret['BLOCK_VARS'][$actual_name] = array(
'ACTUAL_NAME' => $this->user->lang['AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name)], 'ACTUAL_NAME' => $this->user->lang['AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name)],
'KEY' => $new_config['auth_oauth_' . $actual_name . '_key'], 'KEY' => $new_config['auth_oauth_' . $actual_name . '_key'],
'NAME' => $actual_name, 'NAME' => $actual_name,