First to Site
Release 3.4

Contacts Tab Toggle

Environment-driven contacts-tab visibility control added in 3.4.0

Overview

v3.4.0 added an environment toggle to hide or show the Contacts tab on the project edit form without requiring code changes per deployment.

How It Works

Environment variable: SHOW_CONTACTS_TAB in .env (defaults to 0 - hidden). Cast to boolean via %env(bool:SHOW_CONTACTS_TAB)% in services.yaml.

DI wiring: The boolean is registered as the parameter app.show_contacts_tab and injected as $showContactsTab via constructor injection into ProjectCrudController.

Conditional rendering: In two places within the controller (the create and edit form field configurations), the entire CONTACTS tab block - FormField::addTab('CONTACTS') and the userProjectNotifications CollectionField - is wrapped in:

if ($this->showContactsTab) {
    // yield tab and fields
}

When the env var is 0/false, the tab and its fields are never yielded and do not appear in the EasyAdmin form. Setting SHOW_CONTACTS_TAB=1 in .env.local re-enables it.

Files Touched

FileChange
app/.envModified - added SHOW_CONTACTS_TAB=0
app/config/services.yamlModified - parameter and DI argument wiring
Controller/Admin/ProjectCrudController.phpModified - conditional tab rendering

Changelog Reference

  • chore(admin): hide contacts tab via env toggle (#651)