lunfel/october-translatable-trait

Allows to easily setup the locale in OctoberCMS plugin components

Installs: 20

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/lunfel/october-translatable-trait

dev-master 2017-02-02 07:03 UTC

This package is auto-updated.

Last update: 2025-10-29 02:22:07 UTC


README

Add the trait to the component and call the setupLocale method in onRun

<?php namespace Vendor\Plugin\Components;

use Cms\Classes\ComponentBase;
use Lunfel\OctoberCMS\Translation\TranslatableComponentTrait;

class MyComponent extends ComponentBase
{
    use TranslatableComponentTrait;

    public function componentDetails()
    {
        return [
            'name'        => '...',
            'description' => '...'
        ];
    }

    public function defineProperties()
    {
        return [];
    }

    public function onRun()
    {
        $this->setupLocale();
    }
}