4 * Description: Disable images in group edit menu
6 * Author: Thomas Willingham <https://kakste.com/profile/beardyunixer>
10 use Friendica\Core\Hook;
11 use Friendica\Core\Logger;
12 use Friendica\Core\Renderer;
15 function group_text_install()
17 Hook::register('addon_settings', 'addon/group_text/group_text.php', 'group_text_settings');
18 Hook::register('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post');
23 * Callback from the settings post function.
24 * $post contains the $_POST array.
25 * We will make sure we've got a valid user account
26 * and if so set our configuration setting for this person.
30 function group_text_settings_post(App $a, array $post)
32 if (!DI::userSession()->getLocalUserId() || empty($post['group_text-submit'])) {
36 DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'groupedit_image_limit', intval($post['group_text']));
42 * Called from the Addon Setting form.
43 * Add our own settings info to the page.
47 function group_text_settings(App &$a, array &$data)
49 if (!DI::userSession()->getLocalUserId()) {
53 $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'groupedit_image_limit');
55 $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/group_text/');
56 $html = Renderer::replaceMacros($t, [
57 '$enabled' => ['group_text', DI::l10n()->t('Use a text only (non-image) group selector in the "group edit" menu'), $enabled],
61 'addon' => 'group_text',
62 'title' => DI::l10n()->t('Group Text'),