4 * Description: Disable images in group edit menu
6 * Author: Thomas Willingham <https://kakste.com/profile/beardyunixer>
8 use Friendica\Core\Hook;
9 use Friendica\Core\Logger;
12 function group_text_install() {
14 Hook::register('addon_settings', 'addon/group_text/group_text.php', 'group_text_settings');
15 Hook::register('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post');
17 Logger::log("installed group_text");
22 * Callback from the settings post function.
23 * $post contains the $_POST array.
24 * We will make sure we've got a valid user account
25 * and if so set our configuration setting for this person.
29 function group_text_settings_post($a,$post) {
30 if(! local_user() || empty($_POST['group_text-submit']))
32 DI::pConfig()->set(local_user(),'system','groupedit_image_limit',intval($_POST['group_text']));
38 * Called from the Addon Setting form.
39 * Add our own settings info to the page.
45 function group_text_settings(&$a,&$s) {
50 /* Add our stylesheet to the page so we can make our settings look nice */
52 DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/group_text/group_text.css' . '" media="all" />' . "\r\n";
54 /* Get the current state of our config variable */
56 $enabled = DI::pConfig()->get(local_user(),'system','groupedit_image_limit');
57 $checked = (($enabled) ? ' checked="checked" ' : '');
59 /* Add some HTML to the existing form */
61 $s .= '<div class="settings-block">';
62 $s .= '<h3>' . DI::l10n()->t('Group Text') . '</h3>';
63 $s .= '<div id="group_text-enable-wrapper">';
64 $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>';
65 $s .= '<input id="group_text-checkbox" type="checkbox" name="group_text" value="1" ' . $checked . '/>';
66 $s .= '</div><div class="clear"></div>';
68 /* provide a submit button */
70 $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="group_text-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';