Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Admingenerator Activeadmintheme Bundle Laravel Package

cedriclombardot/admingenerator-activeadmintheme-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the bundle to your composer.json:

    composer require cedriclombardot/admingenerator-activeadmintheme-bundle
    

    Enable it in config/bundles.php:

    return [
        // ...
        CedricLombardot\AdmingeneratorActiveAdminThemeBundle\CedricLombardotAdmingeneratorActiveAdminThemeBundle::class => ['all' => true],
    ];
    
  2. Basic Configuration Ensure your config/packages/admingenerator.yaml includes:

    theme: active_admin
    
  3. First Use Case Generate a CRUD interface for an existing entity (e.g., User):

    php bin/console generate:doctrine:crud --entity=App\Entity\User --theme=active_admin
    

    Navigate to /admin/user to see the ActiveAdmin-style interface.


Implementation Patterns

Workflows

  1. Theme Integration

    • Override default templates by placing them in templates/admingenerator/active_admin/.
    • Example: Customize the edit.html.twig for a model by copying vendor/cedriclombardot/admingenerator-activeadmintheme-bundle/Resources/views/active_admin/edit.html.twig to your project’s templates/ directory.
  2. Dynamic Configuration Use YAML or PHP config to tweak ActiveAdmin behavior per entity:

    # config/packages/admingenerator.yaml
    active_admin:
        User:
            dashboard: true
            batch_actions: ['delete']
    
  3. Asset Management

    • Extend CSS/JS by adding assets to assets/admingenerator/active_admin/.
    • Example: Place a custom stylesheet at assets/admingenerator/active_admin/css/custom.css and reference it in your base template.
  4. Form Customization Leverage Twig extensions to modify forms dynamically:

    {{ form_widget(form.field, {'attr': {'data-custom': 'value'}}) }}
    
  5. Permissions & Security Integrate with Symfony’s security system via access_control in admingenerator.yaml:

    access_control:
        User:
            edit: ROLE_ADMIN
            delete: ROLE_SUPER_ADMIN
    

Gotchas and Tips

Pitfalls

  1. Template Overrides

    • Issue: Changes to vendor templates may be overwritten on updates.
    • Fix: Use templates/admingenerator/active_admin/ (not templates/admingenerator/ directly) to avoid conflicts.
  2. Asset Pipeline

    • Issue: Custom JS/CSS may not load due to incorrect paths.
    • Fix: Ensure assets are in assets/admingenerator/active_admin/ and enqueue them in base.html.twig:
      {{ encore_entry_link_tags('admingenerator-active-admin') }}
      
  3. Form Type Conflicts

    • Issue: Custom form types may break the ActiveAdmin theme.
    • Fix: Extend the base form theme in config/packages/twig.yaml:
      twig:
          form_themes: ['admingenerator/active_admin/form.html.twig']
      
  4. Translation Keys

    • Issue: Missing translations for custom fields.
    • Fix: Add translations to translations/messages.en.yaml:
      admingenerator:
          active_admin:
              user:
                  email: "Email Address"
      
  5. Debugging

    • Tip: Enable Twig debugging in config/packages/dev/twig.yaml:
      twig:
          debug: true
          strict_variables: true
      

Extension Points

  1. Custom Actions Add custom actions (e.g., "Export") by creating a service tagged as admingenerator.action:

    # config/services.yaml
    services:
        App\Generator\Action\ExportAction:
            tags: ['admingenerator.action']
    
  2. Event Listeners Hook into the generator lifecycle via events (e.g., admingenerator.generate):

    // src/EventListener/AdmingeneratorListener.php
    public function onGenerate(GenerateEvent $event) {
        $event->setTheme('active_admin');
    }
    
  3. Dynamic Filters Extend the filter system by creating a custom filter class and registering it in admingenerator.yaml:

    filters:
        User:
            - { name: 'active', type: 'boolean' }
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware