Individual settings for the application.
- PHP >= 8.3, < 9
- Drago Project
composer require drago-ex/project-settingsThe files are copied into the project by drago-ex/project-tools,
as set in extra.drago-tools of this package's composer.json.
The settings page is available as:
{link :Backend:Settings:}With drago-ex/project-backend-ui, add the links to its menu (see its README).
The form has a field for every row of the settings table, labelled by its name (website, description). The
labels are translated: when you add a setting to the database, add the translation of its name to
app/Presentation/Backend/Settings/Translate/cs.neon, otherwise the field shows the name itself.
Add the trait to a base presenter whose templates need application settings:
use App\Core\Settings\SettingsRequire;
use Nette\Application\UI\Presenter;
abstract class BasePresenter extends Presenter
{
use SettingsRequire;
}{varType App\Core\Settings\Settings $settings}
{* website name *}
{$settings->get('website')}
{* website description *}
{$settings->get('description')}
{if $settings->has('website')}
{$settings->get('website')}
{/if}The package works without them. Set them up by hand as described below when the project needs them.
With drago-ex/permission, the access rules from bin/create-settings-permission
are generated into the project by:
php vendor/bin/drago-commands