mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-06-07 09:54:27 +02:00
[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,14 +0,0 @@
|
|||
|
||||
|
||||
|
||||
#group_text-enable-label {
|
||||
float: left;
|
||||
width: 200px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
#group_text-checkbox {
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
|
@ -5,8 +5,11 @@
|
|||
* Version: 1.0
|
||||
* Author: Thomas Willingham <https://kakste.com/profile/beardyunixer>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
function group_text_install() {
|
||||
|
@ -42,31 +45,22 @@ function group_text_settings_post($a,$post) {
|
|||
|
||||
|
||||
|
||||
function group_text_settings(&$a,&$s) {
|
||||
|
||||
if(! local_user())
|
||||
function group_text_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
return;
|
||||
|
||||
/* Add our stylesheet to the page so we can make our settings look nice */
|
||||
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/group_text/group_text.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
/* Get the current state of our config variable */
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(local_user(),'system','groupedit_image_limit');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
||||
$s .= '<div class="settings-block">';
|
||||
$s .= '<h3>' . DI::l10n()->t('Group Text') . '</h3>';
|
||||
$s .= '<div id="group_text-enable-wrapper">';
|
||||
$s .= '<label id="group_text-enable-label" for="group_text-checkbox">' . DI::l10n()->t('Use a text only (non-image) group selector in the "group edit" menu') . '</label>';
|
||||
$s .= '<input id="group_text-checkbox" type="checkbox" name="group_text" value="1" ' . $checked . '/>';
|
||||
$s .= '</div><div class="clear"></div>';
|
||||
|
||||
/* provide a submit button */
|
||||
|
||||
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="group_text-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/group_text/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
'$enabled' => ['group_text', DI::l10n()->t('Use a text only (non-image) group selector in the "group edit" menu'), $enabled],
|
||||
]);
|
||||
|
||||
$data = [
|
||||
'addon' => 'group_text',
|
||||
'title' => DI::l10n()->t('Group Text'),
|
||||
'html' => $html,
|
||||
];
|
||||
}
|
||||
|
|
1
group_text/templates/settings.tpl
Normal file
1
group_text/templates/settings.tpl
Normal file
|
@ -0,0 +1 @@
|
|||
{{include file="field_checkbox.tpl" field=$enabled}}
|
Loading…
Add table
Add a link
Reference in a new issue