con un clic
customizing-express-form
Customize the appearance of Express forms in Concrete CMS
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Customize the appearance of Express forms in Concrete CMS
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
This skill provides instructions and best practices for implementing a CRUD (Create, Read, Update, Delete) interface for Doctrine entities within the Concrete CMS Dashboard, following standard core patterns.
Apply this skill whenever you are writing, reviewing, or modifying PHP code for Concrete CMS (concrete5) — custom blocks, packages, single pages, dashboard or dialog or backend controllers, REST endpoints, Express entities, themes, attribute types, jobs, or anything in concrete/controllers, concrete/blocks, controllers/, blocks/, packages/, src/. Use it even when the user does not say "security" — for example, adding a new endpoint, accepting a POST parameter, rendering a user-supplied string, unserializing block config, fetching a URL server-side, or handling a file upload. Concrete CMS shipped 90+ CVEs over the past four years and the failure modes repeat — admin strings rendered raw, missing CSRF tokens on state-changing GETs, unserialize() on stored data, file uploads validated after writing, sequential IDs without per-object authz, type-juggling guard bypasses, OAuth handlers that skip account-state checks. This skill encodes the patterns behind those CVEs so you do not reproduce them.
Create and manage Concrete CMS packages. Use this skill when the user asks to create a custom package or manage existing packages.
Create and manage Concrete CMS block types. Use this skill when the user asks to create or modify custom block types.
This skill provides instructions and best practices for creating and managing single pages in Concrete CMS packages. Use this skill when you need to add custom dashboard pages, specific application logic pages, or any landing pages that don't follow the standard page type/template system.
This skill provides guidance and standard workflows for developing custom themes for Concrete CMS, including directory structure, page templates, asset management, and v9+ features like containers. Use this when creating or modifying Concrete CMS themes.
| name | Customizing Express Form |
| description | Customize the appearance of Express forms in Concrete CMS |
The Express Form is a core block type in Concrete CMS. You can customize the appearance of Express Forms by creating custom templates and overriding the default form context.
To define custom template locations for Express Forms, start by creating a custom FrontendFormContext class. This class allows you to specify a custom attribute context.
<?php
namespace Application\Express\Form\Context;
use Concrete\Core\Express\Form\Context\FrontendFormContext as CoreFrontendFormContext;
class FrontendFormContext extends CoreFrontendFormContext
{
public function getAttributeContext()
{
return new \Application\Attribute\Context\FrontendFormContext();
}
}
To use your custom Form Context, you must create a custom FormController class and register it within the context registry.
<?php
namespace Application\Express\Controller;
use Application\Express\Form\Context\FrontendFormContext;
use Concrete\Core\Express\Controller\StandardController;
use Concrete\Core\Express\Form\Context\FrontendFormContext as CoreFrontendFormContext;
use Concrete\Core\Form\Context\Registry\ContextRegistry;
class FormController extends StandardController
{
public function getContextRegistry()
{
return new ContextRegistry([
CoreFrontendFormContext::class => new FrontendFormContext()
]);
}
}
Register your custom controller as the standard controller for Express by adding the following code to your application's bootstrap or a package's on_start method:
$app->make(\Concrete\Core\Express\Controller\Manager::class)
->setStandardController(\Application\Express\Controller\FormController::class);
By using the custom FrontendFormContext class, you can define custom search paths for attribute templates.
<?php
namespace Application\Attribute\Context;
use Concrete\Core\Attribute\Context\FrontendFormContext as CoreFrontendFormContext;
use Concrete\Core\Filesystem\TemplateLocator;
class FrontendFormContext extends CoreFrontendFormContext
{
public function __construct()
{
parent::__construct();
$this->preferTemplateIfAvailable('custom');
}
public function setLocation(TemplateLocator $locator)
{
$locator->setTemplate('custom');
return $locator;
}
}
With the configuration above, the following overrides become active:
application/attributes/attribute_handle/custom.php overrides the default concrete/attributes/attribute_handle/form.php.application/elements/form/custom.php overrides the default concrete/elements/form/bootstrap5.php.If you are developing a package, you can point the locator to your package directory in the Attribute FrontendFormContext class:
public function __construct()
{
parent::__construct();
// Look for 'custom.php' in the package first
$this->preferTemplateIfAvailable('custom', 'your_package_handle');
}
public function setLocation(TemplateLocator $locator)
{
// Enables packages/your_package_handle/elements/form/custom.php
$locator->setTemplate(['custom', 'your_package_handle']);
return $locator;
}
Also, you can enable overriding elements/express/form/form/form.php in your package by adding setLocation method in the Express Form FrontendFormContext class.
public function setLocation(TemplateLocator $locator)
{
$locator = parent::setLocation($locator);
$locator->prependLocation([
DIRNAME_ELEMENTS .
'/' .
DIRNAME_EXPRESS .
'/' .
DIRNAME_EXPRESS_FORM_CONTROLS .
'/' .
DIRNAME_EXPRESS_FORM_CONTROLS, // not a typo
'your_package_handle' // Package Handle
]);
return $locator;
}