4 * Description: Disable images in circle edit menu
6 * Author: Thomas Willingham <https://kakste.com/profile/beardyunixer>
9 use Friendica\Core\Hook;
10 use Friendica\Core\Renderer;
13 function circle_text_install()
15 Hook::register('addon_settings', __FILE__, 'circle_text_settings');
16 Hook::register('addon_settings_post', __FILE__, 'circle_text_settings_post');
21 * Callback from the settings post function.
22 * $post contains the $_POST array.
23 * We will make sure we've got a valid user account
24 * and if so set our configuration setting for this person.
28 function circle_text_settings_post(array $post)
30 if (!DI::userSession()->getLocalUserId() || empty($post['circle_text-submit'])) {
34 DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'circle_edit_image_limit', intval($post['circle_text']));
40 * Called from the Addon Setting form.
41 * Add our own settings info to the page.
45 function circle_text_settings(array &$data)
47 if (!DI::userSession()->getLocalUserId()) {
51 $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'circle_edit_image_limit') ??
52 DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'groupedit_image_limit');
54 $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/circle_text/');
55 $html = Renderer::replaceMacros($t, [
56 '$enabled' => ['circle_text', DI::l10n()->t('Use a text only (non-image) circle selector in the "circle edit" menu'), $enabled],
60 'addon' => 'circle_text',
61 'title' => DI::l10n()->t('Circle Text'),