[various] Convert addon_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:
Hypolite Petovan 2021-11-20 04:56:55 -05:00
parent f0522a998b
commit 779b38ec09
68 changed files with 444 additions and 953 deletions

View file

@ -45,7 +45,7 @@ function showmore_dyn_settings_post()
}
}
function showmore_dyn_settings(App &$a, &$o)
function showmore_dyn_settings(App &$a, array &$data)
{
if(!local_user()) {
return;
@ -55,12 +55,15 @@ function showmore_dyn_settings(App &$a, &$o)
DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $limitHeight);
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/showmore_dyn/');
$o .= Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'),
'$header' => DI::l10n()->t('Show More Dynamic'),
$html = Renderer::replaceMacros($t, [
'$limitHeight' => ['limitHeight', DI::l10n()->t('Limit Height'), $limitHeight, DI::l10n()->t('The maximal pixel height of posts before the Show More link is added, 0 to disable'), '', '', 'number'],
]);
$data = [
'addon' => 'showmore_dyn',
'title' => DI::l10n()->t('Show More Dynamic'),
'html' => $html,
];
}
function showmore_dyn_script()

View file

@ -1,13 +1 @@
<span id="settings_showmore_dyn_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_showmore_dyn_expanded'); openClose('settings_showmore_dyn_inflated');">
<h3>{{$header}}</h3>
</span>
<div id="settings_showmore_dyn_expanded" class="settings-block" style="display: none;">
<span class="fakelink" onclick="openClose('settings_showmore_dyn_expanded'); openClose('settings_showmore_dyn_inflated');">
<h3>{{$header}}</h3>
</span>
{{include file="field_input.tpl" field=$limitHeight}}
<div class="settings-submit-wrapper">
<input type="submit" value="{{$submit}}" class="settings-submit" name="showmore_dyn-submit" />
</div>
</div>
{{include file="field_input.tpl" field=$limitHeight}}