PHP code example of matycz / lemo-theme

1. Go to this page and download the library: Download matycz/lemo-theme library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

matycz / lemo-theme example snippets


     return array(
         ...
         'modules' => array(
            ...
            'Lemo\Theme'
            ...
         ),
         ...
     );
     



namespace Foo\Controller;

use Lemo\Theme\ThemeManagerInterface;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;

class BarController extends AbstractActionController
{
    /**
     * @var ThemeManagerInterface
     */
    protected $themeManager;
    
    ...

    /**
     * Page with grid example
     *
     * @return ViewModel
     */
    public function indexAction()
    {
        // Example1 - Set new theme with name foo
        $this->getThemeManager()->setTheme('foo');

        // Example 2 - Set new theme with name foo
        $this->getServiceLocator()->get('ThemeManager')->setTheme('foor');

        return new ViewModel(array(
            ...
        ));
    }
    
    ...
    
    /**
     * @param  ThemeManagerInterface $themeManager
     * @return BarController
     */
    public function setThemeManager(ThemeManagerInterface $themeManager)
    {
        $this->themeManager = $themeManager;

        return $this;
    }

    /**
     * @return ThemeManagerInterface
     */
    public function getThemeManager()
    {
        return $this->themeManager;
    }
}

<p class="current-theme"><?= $this->theme()