. // }}} namespace Plugin\ProfileColor; use App\Core\DB\DB; use App\Core\Event; use App\Core\Module; use App\Core\Router\RouteLoader; use App\Util\Common; /** * Profile Color plugin main class * * @package GNUsocial * @category CoverPlugin * * @author Daniel Brandao * @copyright 2020 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ class ProfileColor extends Module { /** * Map URLs to actions * * @param RouteLoader $r * * @return bool hook value; true means continue processing, false means stop. */ public function onAddRoute(RouteLoader $r): bool { $r->connect('settings_profile_color', 'settings/color', [Controller\ProfileColor::class, 'profilecolorsettings']); return Event::next; } /** * Populate twig vars * * @param array $vars * * @return bool hook value; true means continue processing, false means stop. */ public function onStartTwigPopulateVars(array &$vars): bool { $vars['profile_tabs'][] = ['title' => 'Color', 'route' => 'settings_profile_color', ]; /* if (Common::user() != null) { $cover = DB::find('cover', ['gsactor_id' => Common::user()->getId()]); if ($cover != null) { $vars['profile_extras'][] = ['name' => 'cover', 'vars' => ['img' => '/cover']]; } else { $vars['profile_extras'][] = ['name' => 'cover', 'vars' => []]; } } */ return Event::next; } /** * Output our dedicated stylesheet * * @param array $styles stylesheets path * * @return bool hook value; true means continue processing, false means stop. */ public function onStartShowStyles(array &$styles): bool { //$styles[] = 'cover/cover.css'; return Event::next; } }