[various] Convert connector_settings hook functions to the new data array format
- Add separate template files to several addons - Remove superfluous addon settings CSS files
This commit is contained in:
parent
779b38ec09
commit
9acfdb4090
36 changed files with 612 additions and 1012 deletions
|
@ -36,7 +36,7 @@ function discourse_install()
|
|||
Hook::register('connector_settings_post', __FILE__, 'discourse_settings_post');
|
||||
}
|
||||
|
||||
function discourse_settings(App $a, &$s)
|
||||
function discourse_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
return;
|
||||
|
@ -44,12 +44,18 @@ function discourse_settings(App $a, &$s)
|
|||
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'discourse', 'enabled'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/discourse/');
|
||||
$s .= Renderer::replaceMacros($t, [
|
||||
'$title' => DI::l10n()->t('Discourse'),
|
||||
$t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/discourse/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
'$enabled' => ['enabled', DI::l10n()->t('Enable processing of Discourse mailing list mails'), $enabled, DI::l10n()->t('If enabled, incoming mails from Discourse will be improved so they look much better. To make it work, you have to configure the e-mail settings in Friendica. You also have to enable the mailing list mode in Discourse. Then you have to add the Discourse mail account as contact.')],
|
||||
'$submit' => DI::l10n()->t('Save Settings'),
|
||||
]);
|
||||
|
||||
$data = [
|
||||
'connector' => 'discourse',
|
||||
'title' => DI::l10n()->t('Discourse'),
|
||||
'image' => 'images/discourse.png',
|
||||
'enabled' => $enabled,
|
||||
'html' => $html,
|
||||
];
|
||||
}
|
||||
|
||||
function discourse_settings_post(App $a)
|
||||
|
|
1
discourse/templates/connector_settings.tpl
Normal file
1
discourse/templates/connector_settings.tpl
Normal file
|
@ -0,0 +1 @@
|
|||
{{include file="field_checkbox.tpl" field=$enabled}}
|
|
@ -1,15 +0,0 @@
|
|||
<span id="settings_discourse_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_discourse_expanded'); openClose('settings_discourse_inflated');">
|
||||
<img class="connector{{if ! $enabled.2}}-disabled{{/if}}" src="images/discourse.png" /><h3 class="connector">{{$title}}</h3>
|
||||
</span>
|
||||
<div id="settings_discourse_expanded" class="settings-block" style="display: none;">
|
||||
<span class="fakelink" onclick="openClose('settings_discourse_expanded'); openClose('settings_discourse_inflated');">
|
||||
<img class="connector{{if ! $enabled.2}}-disabled{{/if}}" src="images/discourse.png" /><h3 class="connector">{{$title}}</h3>
|
||||
</span>
|
||||
|
||||
<div id="discourse-wrapper">
|
||||
{{include file="field_checkbox.tpl" field=$enabled}}
|
||||
</div>
|
||||
<div class="settings-submit-wrapper" >
|
||||
<input type="submit" id="discourse-submit" name="discourse-submit" class="settings-submit" value="{{$submit}}" />
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue