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

Cms Slot Bundle Laravel Package

elao/cms-slot-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the bundle to your Laravel project via Composer:

    composer require elao/cms-slot-bundle
    

    Ensure it’s enabled in config/bundles.php (Symfony) or config/app.php (Laravel) under Elao\CmsSlotBundle\ElaoCmsSlotBundle.

  2. Configuration Publish the default config:

    php artisan vendor:publish --tag=elao-cms-slot-config
    

    Update config/elao_cms_slot.php to match your TinyMCE, File Manager, and Image Manager plugin paths.

  3. First Use Case Integrate the bundle into a TinyMCE editor instance:

    tinymce.init({
        selector: '#my-editor',
        plugins: 'filemanager imagemanager',
        filemanager_callback: (field_name, url, type, win) => {
            // Handle file/image selection
        },
        imagemanager_callback: (field_name, url, type, win) => {
            // Handle image selection
        }
    });
    

    Ensure your backend routes handle the filemanager and imagemanager callbacks (e.g., via Symfony’s elao_cms_slot routes).


Implementation Patterns

Workflow Integration

  1. Editor Initialization Use the bundle’s Symfony routes (elao_cms_slot_filemanager, elao_cms_slot_imagemanager) as callbacks in TinyMCE:

    tinymce.init({
        selector: '#editor',
        plugins: 'filemanager imagemanager',
        filemanager_url: '/filemanager', // Route from bundle
        imagemanager_url: '/imagemanager' // Route from bundle
    });
    
  2. Backend Handling Extend the bundle’s controllers (ElaoCmsSlotBundle:FileManager/ImageManager) to customize file/image handling:

    // app/Http/Controllers/CustomFileManagerController.php
    namespace App\Http\Controllers;
    
    use Elao\CmsSlotBundle\Controller\FileManagerController;
    
    class CustomFileManagerController extends FileManagerController {
        protected function getAllowedMimeTypes() {
            return ['image/jpeg', 'image/png', 'application/pdf'];
        }
    }
    

    Update routes in routes/web.php:

    use App\Http\Controllers\CustomFileManagerController;
    
    Route::get('/custom-filemanager', [CustomFileManagerController::class, 'index']);
    
  3. Asset Management Override default asset paths (e.g., TinyMCE plugins) in elao_cms_slot.php:

    'tinymce_plugin_path' => '/vendor/tinymce/tinymce/plugins',
    'filemanager_plugin_path' => '/vendor/elao/filemanager',
    
  4. Laravel-Specific Adaptations Use Laravel’s service container to bind custom services (e.g., storage adapters):

    // config/app.php
    'bindings' => [
        Elao\CmsSlotBundle\Service\FileManager::class => App\Services\CustomFileManager::class,
    ];
    

Gotchas and Tips

Pitfalls

  1. Route Conflicts The bundle’s default routes (/filemanager, /imagemanager) may clash with existing routes. Solution: Override routes entirely or use route prefixes:

    Route::prefix('admin')->group(function () {
        Route::get('/filemanager', [CustomController::class, 'index']);
    });
    
  2. Plugin Path Assumptions The bundle assumes TinyMCE and manager plugins are in default paths. Solution: Always verify and update elao_cms_slot.php paths.

  3. CSRF Token Mismatch Symfony’s CSRF protection may block AJAX requests from TinyMCE. Solution: Exclude routes or use meta tags:

    <meta name="csrf-token" content="{{ csrf_token() }}">
    

    In JavaScript:

    headers: { 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content }
    
  4. Archived Package Risks The package is archived (no active maintenance). Solution:

    • Fork the repo and update dependencies.
    • Monitor for breaking changes in TinyMCE/FileManager plugins.

Debugging Tips

  1. Check Console Logs TinyMCE errors often appear in browser console. Enable debug mode in elao_cms_slot.php:

    'debug' => env('APP_DEBUG', false),
    
  2. Verify Plugin Loading Ensure TinyMCE plugins are loaded before initialization:

    tinymce.init({
        // ...
        setup: function(editor) {
            console.log('Plugins loaded:', editor.plugins);
        }
    });
    
  3. Storage Permissions File uploads may fail due to storage permissions. Solution:

    chmod -R 775 storage/app/public
    

Extension Points

  1. Custom File/Image Handlers Extend Elao\CmsSlotBundle\Service\FileManager or ImageManager to add logic:

    public function handleUpload($file, $path) {
        // Custom logic (e.g., rename, resize)
        return parent::handleUpload($file, $path);
    }
    
  2. Dynamic Plugin Configuration Use Laravel’s view composers to inject dynamic TinyMCE settings:

    View::composer('*', function ($view) {
        $view->with('tinymceSettings', [
            'filemanager_title' => 'Custom File Manager',
            'imagemanager_title' => 'Custom Image Manager'
        ]);
    });
    
  3. Event Listeners Listen for bundle events (if documented) or create custom events:

    Event::listen('elao.cms_slot.file.uploaded', function ($event) {
        // Post-upload logic
    });
    
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.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui