### List Themes Response Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/themes.md Example JSON response when listing themes. It contains a 'themes' object with details for each installed theme. ```json { "themes": { "blank": { "name": "Blank", "key": "blank", "config": { "name": "Blank", "author": "Mautic team", "authorUrl": "https://mautic.org", "features": [ "page", "email", "form" ] } } } } ``` -------------------------------- ### Get Theme Response Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/themes.md Example JSON response when a theme is successfully retrieved. It indicates the path to the downloaded ZIP file. ```json { "file": "/absolute/path/to/the/system/temp/dir/with/the/theme/zip/file" } ``` -------------------------------- ### Start DDEV Environment Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/testing/e2e_test_suite.md Start the DDEV environment for Mautic development. Ensure DDEV is installed prior to running this command. ```bash ddev start ``` -------------------------------- ### HTTP Request Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/campaigns.md Demonstrates the GET request format to retrieve a campaign. Replace ID with the actual campaign identifier. ```http GET /campaigns/ID ``` -------------------------------- ### Fetch API Keys from Integration Configuration Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/plugin_integrations/integrations_configuration.md Retrieve API keys for an integration using the integration helper. This example shows how to get the 'username' from the stored API keys. ```php get(HelloWorldIntegration::NAME)->getIntegrationConfiguration()->getApiKeys(); $username = $apiKeys['username']; ``` -------------------------------- ### Start DDEV Environment for Mautic Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/development-environment/how_to_install_with_ddev.md Navigate to the Mautic directory and start the DDEV environment. ```bash cd mautic ddev start ``` -------------------------------- ### Run Mautic Command-Line Installation Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/development-environment/setup.md Execute this bash command to initiate the Mautic installation process via the command line, specifying the installation URL. ```bash php bin/console mautic:install https://mautic.example.com ``` -------------------------------- ### Get User API Response Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/users.md Provides an example of a successful JSON response when retrieving user details. It includes various properties of the user object. ```json { "user": { "isPublished": true, "dateAdded": "2026-02-21T05:19:56+00:00", "dateModified": "2026-02-21T05:20:13+00:00", "createdBy": 1, "createdByUser": "Admin Mautic", "modifiedBy": 1, "modifiedByUser": "Admin Mautic", "id": 3, "username": "r.green", "firstName": "Rachel", "lastName": "Green", "email": "rachel.green@acme.com", "position": "Marketing Staff", "role": { "createdByUser": "Admin Mautic", "modifiedByUser": null, "id": 2, "name": "Email Permissions", "description": null, "isAdmin": false, "rawPermissions": { "email:categories": [ "full" ], "email:emails": [ "full" ] } }, "timezone": "Europe/Paris", "locale": null, "lastLogin": "2026-02-22T04:28:00+00:00", "lastActive": "2026-02-22T04:28:00+00:00", "signature": "Best regards, \r\nRachel Green" } } ``` -------------------------------- ### Plugin Database Migration Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/plugins/installation.md Example of a Mautic plugin migration file. The `isApplicable` method checks if the migration needs to run, and the `up` method defines the SQL schema changes. ```php getTable($this->concatPrefix($this->table))->hasColumn('is_enabled'); } catch (SchemaException $e) { return false; } } protected function up(): void { $this->addSql("ALTER TABLE `{$this->concatPrefix($this->table)}` ADD `is_enabled` tinyint(1) 0"); $this->addSql("CREATE INDEX {$this->concatPrefix('is_enabled')} ON {$this->concatPrefix($this->table)}(is_enabled);"); } } ``` -------------------------------- ### Get Stage Response Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/stages.md Example JSON response when successfully retrieving an individual Stage. This includes properties like publication status, dates, creator, and stage-specific details. ```json { "stage": { "isPublished": true, "dateAdded": "2026-02-13T16:11:07+00:00", "dateModified": null, "createdBy": 1, "createdByUser": "John Doe", "modifiedBy": 1, "modifiedByUser": "John Doe", "id": 7, "name": "Stage A", "category": null, "weight": 0, "description": "This is my first stage created via API.", "publishUp": "2026-02-13T17:00:00+00:00", "publishDown": "2026-02-20T17:00:00+00:00" } } ``` -------------------------------- ### List Assets Response Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/assets.md An example of the JSON response when listing assets. It includes total count and an array of asset objects. ```json { "total": 1, "assets": [ { "id": 1, "title": "Product Whitepaper", "description": "Some description", "alias": "whitepaper", "language": "en", "isPublished": true, "publishUp": "2015-06-07T06:28:27+00:00", "publishDown": "2015-06-30T06:28:27+00:00", "dateAdded": "2015-06-07T06:28:27+00:00", "createdBy": 1, "createdByUser": "Wayne Costa", "dateModified": "2015-06-010T09:30:47+00:00", "modifiedBy": 1, "modifiedByUser": "Wayne Costa", "downloadCount": 10, "uniqueDownloadCount": 8, "revision": 1, "category": null, "extension": "pdf", "mime": "application/pdf", "size": 269128, "downloadUrl": "https://example.com/asset/1:whitepaper" } ] } ``` -------------------------------- ### HTTP Request Examples for Reports Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/reports.md Examples of HTTP GET requests to retrieve report data. Demonstrates fetching a report by ID and specifying query parameters for filtering and pagination. ```http GET /reports/ID ``` ```http GET /reports/3?dateFrom=2017-01-01&dateTo=2018-01-01&limit=5&page=3 ``` -------------------------------- ### Get Tag Response Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/tags.md Example JSON response when successfully retrieving an individual Tag. It includes the tag's ID, name, and description. ```json { "tag": { "id": 34, "tag": "tagA", "description": "A tag for grouping contacts" } } ``` -------------------------------- ### Lead Event Subscriber Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/plugins/event_listeners.md This example demonstrates how to create an event subscriber to listen for lead-related events like post-save and post-delete. Ensure the subscriber class is correctly namespaced and implements `EventSubscriberInterface`. ```php ['onLeadPostSave', 0], LeadEvents::LEAD_POST_DELETE => ['onLeadDelete', 0], ]; } public function onLeadPostSave(LeadEvent $event): void { $lead = $event->getLead(); // do something } public function onLeadDelete(LeadEvent $event): void { $lead = $event->getLead(); $deletedId = $lead->deletedId; // do something } } // ... ``` -------------------------------- ### Example Acceptance Test Class Structure Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/testing/e2e_test_suite.md Defines the basic structure of an acceptance test class in Codeception. Includes setup and teardown methods, and a sample test scenario for login. ```PHP amOnPage('/s/login'); $I->fillField('#username', $name); $I->fillField('#password', $password); $I->click('button[type=submit]'); $I->see('Dashboard'); } } ``` -------------------------------- ### List All Installed Themes Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/themes.md Retrieves a list of all installed themes, including details from their respective `config.json` files. ```php getList(); ``` -------------------------------- ### Set Temporary File Path Response Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/themes.md Example JSON response after successfully changing the temporary file path. It confirms the new path and indicates a ZIP file within it. ```json { "file": "/absolute/path/to/a/different/temp/dir/zipfile" } ``` -------------------------------- ### Complete Accordion Component Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/design_templates/accordion.md A comprehensive example demonstrating the integration of the Accordion Component, including defining content with a set block and including the component with specific item configurations. ```twig {% set utmTagsContent %} {% for i, utmTag in form.utmTags %} {{ form_row(utmTag) }} {% endfor %} {% endset %} {% include '@MauticCore/Helper/accordion.html.twig' with { 'items': [ { 'id': 'UTM', 'title': 'mautic.email.utm_tags', 'padding_inline': false, 'content': utmTagsContent, } ] } %} ``` -------------------------------- ### FormController Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/plugins/mvc.md Demonstrates extending Mautic's FormController to create custom actions for managing forms and handling user input. Includes examples for retrieving data, creating forms, and processing submissions. ```php getWorldDetails($world); return $this->delegateView( [ 'viewParameters' => [ 'world' => $world, 'details' => $worldDetails ], 'contentTemplate' => 'HelloWorldBundle:World:details.html.php', 'passthroughVars' => [ 'activeLink' => 'plugin_helloworld_world', 'route' => $this->generateUrl('plugin_helloworld_world', ['world' => $world]), 'mauticContent' => 'helloWorldDetails' ] ] ); } public function contactAction(ContactModel $model): Response { // Create the form object $form = $this->formFactory->create(ContactFormType::class); // Handle form submission if POST if ($this->request->getMethod() == 'POST') { $flashes = []; // isFormCancelled() checks if the cancel button was clicked if ($cancelled = $this->isFormCancelled($form)) { // isFormValid() will bind the request to the form object and validate the data if ($valid = $this->isFormValid($form)) { // Send the email $model->sendContactEmail($form->getData()); // Set success flash message $flashes[] = [ 'type' => 'notice', 'msg' => 'plugin.helloworld.notice.thank_you', 'msgVars' => [ '%name%' => $form['name']->getData() ] ]; } } if ($cancelled || $valid) { // Redirect to /hello/world return $this->postActionRedirect( [ 'returnUrl' => $this->generateUrl('plugin_helloworld_world'), 'contentTemplate' => 'MauticPlugin\HelloWorldBundle\Controller\DefaultController:worldAction', 'flashes' => $flashes ] ); } // Otherwise show the form again with validation error messages } // Display the form return $this->delegateView( [ 'viewParameters' => [ 'form' => $form->createView() ), 'contentTemplate' => '@HelloWorld/Contact/form.html.twig', 'passthroughVars' => [ 'activeLink' => 'plugin_helloworld_contact', 'route' => $this->generateUrl('plugin_helloworld_contact') ] ] ); } } ``` -------------------------------- ### Plugin Install and Update Event Listener Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/plugins/installation.md Implement this listener to react to plugin installation and update events. Available since Mautic 4.2.0. ```php ['onPluginInstall', 0], PluginEvents::ON_PLUGIN_UPDATE => ['onPluginUpdate', 0], ]; } public function onPluginInstall(PluginInstallEvent $event) { // Handle your logic here } public function onPluginUpdate(PluginUpdateEvent $event) { // Handle your logic here } } ``` -------------------------------- ### List Notifications Response Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/notifications.md An example of the JSON response when listing notifications. It includes total count and an array of notification objects. ```json { "total":1, "notifications":[ { "isPublished":true, "dateAdded":"2016-09-14T14:03:05+00:00", "createdBy":1, "createdByUser":"John Doe", "dateModified":"2016-09-15T08:40:46+00:00", "modifiedBy":1, "modifiedByUser":"John Doe", "id":1, "name":"The first notification", "heading":"The first notification Heading", "message":"The first notification Message", "url":"http:\/\/mautic.org", "language":"en", "category":null, "publishUp":null, "publishDown":null, "readCount":0, "sentCount":0 } ] } ``` -------------------------------- ### List Themes Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/themes.md Lists all installed Themes along with details extracted from their `config.json` files. ```APIDOC ## List Themes ### Description Lists all installed Themes with details from their `config.json` files. ### Method GET ### Endpoint `/themes` ### Response #### Success Response (200) - **themes** (object) - A dictionary where keys are theme keys and values are theme objects. #### Theme object properties - **name** (string) - Display name of the Theme. - **key** (string) - Directory name and unique identifier of the Theme. - **config** (object) - Theme configuration from `config.json`. #### Config object properties - **name** (string) - Theme name. - **author** (string) - Theme author. - **authorUrl** (string) - Author’s website URL. - **features** (array) - List of supported features such as `page`, `email`, or `form`. - **builder** (array) - Optional list of compatible builders such as `legacy` or `grapeJs`. ### Response Example ```json { "themes": { "blank": { "name": "Blank", "key": "blank", "config": { "name": "Blank", "author": "Mautic team", "authorUrl": "https://mautic.org", "features": [ "page", "email", "form" ] } } } } ``` ``` -------------------------------- ### List Themes HTTP Request Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/themes.md This is the HTTP request format for listing all installed themes. ```http GET /themes ``` -------------------------------- ### Configure OAuth2 Credentials and Initiate Token Process Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/plugin_integrations/integrations_authentication.md This example demonstrates how to retrieve integration configuration, generate a redirect URI, and set up the necessary credentials for OAuth2 authentication. It prepares the client for the token exchange process using the authorization code. ```php getIntegration(HelloWorldIntegration::NAME); /** @var Router $router */ $redirectUrl = $router->generate('mautic_integration_public_callback', ['integration' => HelloWorldIntegration::NAME]); $configuration = $integration->getIntegrationConfiguration(); $apiKeys = $configuration->getApiKeys(); /** @var Request $request */ $code = $request->get('code'); $credentials = new class( 'https://example.com/api/oauth/authorize', 'https://example.com/api/oauth/token', $redirectUrl, 'scope1,scope2', $apiKeys['client_id'], $apiKeys['client_secret'], $code ) implements CredentialsInterface, RedirectUriInterface, ScopeInterface, CodeInterface { private $authorizeUrl; private $tokenUrl; private $redirectUrl; private $scope; private $clientId; private $clientSecret; private $code; public function __construct(string $authorizeUrl, string $tokenUrl, string $redirectUrl, string $scope, string $clientId, string $clientSecret, ?string $code) { $this->authorizeUrl = $authorizeUrl; $this->tokenUrl = $tokenUrl; $this->redirectUrl = $redirectUrl; $this->scope = $scope; $this->clientId = $clientId; $this->clientSecret = $clientSecret; $this->code = $code; } public function getAuthorizationUrl(): string { return $this->authorizeUrl; } public function getTokenUrl(): string { return $this->tokenUrl; } public function getRedirectUri(): string { return $this->redirectUrl; } public function getClientId(): ?string { return $this->clientId; } public function getClientSecret(): ?string { return $this->clientSecret; } public function getScope(): ?string { ``` -------------------------------- ### Implement AuthenticationInterface for Hello World Integration Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/plugin_integrations/integrations_authentication.md Provides the full implementation of the AuthenticationInterface for a sample 'Hello World' integration. It includes methods to check authentication status and handle the authentication process by obtaining an access token. ```php client = $client; } public function getName(): string { return HelloWorldIntegration::NAME; } public function getDisplayName(): string { return 'Hello World'; } /** * Returns true if the integration has already been authorized with the third party service. * * @return bool */ public function isAuthenticated(): bool { $apiKeys = $this->getIntegrationConfiguration()->getApiKeys(); return !empty($apiKeys['access_token']) && !empty($apiKeys['refresh_token']); } /** * Authenticate and obtain the access token * * @param Request $request * * @return string */ public function authenticateIntegration(Request $request): string { $code = $request->query->get('code'); $this->client->authenticate($code); return 'Success!'; } } ``` -------------------------------- ### Get User HTTP Request Example Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/rest_api/users.md Illustrates the HTTP GET request format for retrieving a specific user by their ID. The endpoint is /users/ID. ```http GET /users/ID ``` -------------------------------- ### Combining Flex Utilities Source: https://github.com/mautic/developer-documentation-new/blob/7.1/docs/design/utilities.md This example demonstrates combining multiple flex utilities to create a responsive and centered layout. It sets up a flex container that behaves as a column on small screens and a row on medium screens and up, with wrapping, centering, and a fixed gap between items. ```html
Acme Global Conference registration.
", "cachedHtml": "\n\n\n\n