Installation:
composer require aropixel/page-bundle
Ensure aropixel/admin-bundle is already installed.
Configure Routes:
Add to config/routes.yaml:
aropixel_page:
resource: "@AropixelPageBundle/src/Resources/config/routes.yaml"
prefix: /admin/page
Create Custom Entities:
Extend the base entities in src/Entity/Page.php and src/Entity/PageTranslation.php.
Run Migrations:
php bin/console make:migration
php bin/console doctrine:migrations:migrate
First Use Case:
Create a page via the admin interface (/admin/page). Use TYPE_DEFAULT for simple HTML content or TYPE_CUSTOM for the visual builder.
Page Creation & Management:
/admin/page) to create pages of type TYPE_DEFAULT (CKEditor) or TYPE_CUSTOM (visual builder).TYPE_CUSTOM, the JSON payload is pre-rendered to HTML at save time, stored in htmlContent, and displayed with {{ page.htmlContent|raw }} in Twig.Fixed Pages:
#[AsFixedPage] attribute:
#[AsFixedPage(code: 'homepage', title: 'Home')]
class HomepageFixedPage {}
php bin/console aropixel:page:sync-fixed
staticCode:
$page = $pageRepository->findOneBy(['staticCode' => 'homepage']);
Custom JSON Page Types:
AbstractJsonPageType for structured forms (e.g., contact pages):
class ContactPageType extends AbstractJsonPageType {
protected function buildCustomForm(FormBuilderInterface $builder, array $options): void {
$builder->add('phone', TextType::class);
}
public function getType(): string { return 'contact'; }
}
templates/bundles/AropixelPageBundle/{type}/form.html.twig.Multilingual Support:
aropixel_admin.translations.locales (AdminBundle).Front-End Integration:
{{ page.htmlContent|raw }}
$page = $pageRepository->findOneBy(['slug' => 'about']);
Events: Listen to PageSavedEvent to invalidate caches (Varnish, Redis) after page updates:
use Aropixel\PageBundle\Event\PageSavedEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
#[AsEventListener(event: PageSavedEvent::class, method: 'onPageSaved')]
public function onPageSaved(PageSavedEvent $event): void {
// Invalidate cache logic
}
Custom Blocks: Extend the visual builder with custom blocks (see custom-blocks.md).
SEO: Leverage metaTitle, metaDescription, and slug fields per locale for SEO optimization.
Entity Configuration:
config/packages/aropixel_page.yaml with custom entity classes after extending the base entities will cause Doctrine errors.aropixel_page:
entities:
Aropixel\PageBundle\Entity\PageInterface: App\Entity\Page
Aropixel\PageBundle\Entity\PageTranslationInterface: App\Entity\PageTranslation
Fixed Pages Sync:
aropixel:page:sync-fixed without defining #[AsFixedPage] classes will create no fixed pages.src/).Page Builder Styling:
title_styles or button_colors in aropixel_page.yaml hides the corresponding selectors in the builder.title_styles: []
button_colors: []
Multilingual Slugs:
/en/about and /fr/about).JavaScript Assets:
assets/ requires rebuilding with npm run build before committing.assets/ and src/Resources/public/js/.Pre-Rendered HTML Issues:
htmlContent is empty or incorrect, check the jsonContent for malformed JSON or unsupported blocks.jsonContent in a PageSavedEvent listener to inspect the payload.Fixed Pages Not Syncing:
#[AsFixedPage] classes are in a directory covered by Symfony’s autodiscovery (e.g., src/).php bin/console debug:autowiring to verify the classes are loaded.Custom Block Not Loading:
Custom Page Types:
AbstractJsonPageType to create reusable page structures (e.g., "Product Page," "Blog Post").Block Extensions:
Event Listeners:
PageSavedEvent, PageDeletedEvent, or PagePublishedEvent (e.g., for analytics or notifications).Twig Overrides:
templates/bundles/AropixelPageBundle/.Configuration:
title_styles or button_colors via services or commands (e.g., fetch styles from a database).How can I help you explore Laravel packages today?