[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:
parent
f0522a998b
commit
779b38ec09
68 changed files with 444 additions and 953 deletions
|
@ -1,16 +0,0 @@
|
|||
|
||||
#gnot-desc {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#gnot-label {
|
||||
float: left;
|
||||
width: 200px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
#gnot {
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
@ -49,31 +50,25 @@ function gnot_settings_post($a,$post) {
|
|||
|
||||
|
||||
|
||||
function gnot_settings(&$a,&$s) {
|
||||
|
||||
if(! local_user())
|
||||
function gnot_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Add our stylesheet to the page so we can make our settings look nice */
|
||||
$gnot = intval(DI::pConfig()->get(local_user(), 'gnot', 'enable'));
|
||||
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/gnot/gnot.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$gnot = intval(DI::pConfig()->get(local_user(),'gnot','enable'));
|
||||
|
||||
$gnot_checked = (($gnot) ? ' checked="checked" ' : '' );
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/gnot/');
|
||||
/* Add some HTML to the existing form */
|
||||
|
||||
$s .= Renderer::replaceMacros($t, [
|
||||
'$title' => DI::l10n()->t('Gnot Settings') ,
|
||||
'$submit' => DI::l10n()->t('Save Settings'),
|
||||
'$enable' => DI::l10n()->t('Enable this addon?'),
|
||||
'$enabled' => $gnot_checked,
|
||||
'$text' => DI::l10n()->t("Allows threading of email comment notifications on Gmail and anonymising the subject line.")
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/gnot/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
'$text' => DI::l10n()->t("Allows threading of email comment notifications on Gmail and anonymising the subject line."),
|
||||
'$enabled' => ['gnot', DI::l10n()->t('Enable this addon?'), $gnot],
|
||||
]);
|
||||
|
||||
$data = [
|
||||
'addon' => 'gnot',
|
||||
'title' => DI::l10n()->t('Gnot Settings'),
|
||||
'html' => $html,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,20 +1,2 @@
|
|||
<span id="settings_gnot_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_gnot_expanded\'); openClose(\'settings_gnot_inflated\');">
|
||||
<h3>{{$title}}</h3>
|
||||
</span>
|
||||
<div id="settings_gnot_expanded" class="settings-block" style="display: none;">
|
||||
<span class="fakelink" onclick="openClose(\'settings_gnot_expanded\'); openClose(\'settings_gnot_inflated\');">
|
||||
<h3>{{$title}}</h3>
|
||||
</span>
|
||||
<div id="gnot-wrapper">
|
||||
<div id="gnot-desc">{{$text}}</div>
|
||||
<label id="gnot-label" for="gnot">{{$enable}}</label>
|
||||
<input id="gnot-input" type="checkbox" name="gnot" value="1" {{$enabled}} />
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
||||
/* provide a submit button */
|
||||
|
||||
<div class="settings-submit-wrapper" >
|
||||
<input type="submit" name="gnot-submit" class="settings-submit" value="{{$submit}}" />
|
||||
</div>
|
||||
</div>
|
||||
<p>{{$text}}</p>
|
||||
{{include file="field_checkbox.tpl" field=$enabled}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue