PHP code example of agence-adeliom / lumberjack-admin

1. Go to this page and download the library: Download agence-adeliom/lumberjack-admin 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/ */

    

agence-adeliom / lumberjack-admin example snippets


'providers' => [
    ...
    \Adeliom\Lumberjack\Admin\AdminProvider::class
]



namespace App\Admin;

use Adeliom\Lumberjack\Admin\AbstractAdmin;
use Traversable;

class PostAdmin extends AbstractAdmin
{
    public const TITLE = "Post edit interface";
    
    /**
     * @see https://github.com/vinkla/extended-acf#fields
     * @return Traversable
     */
    public static function getFields(): Traversable
    {
        yield Text::make('Post subtitle', 'subtitle');
    }
    
    /**
     * @see https://github.com/vinkla/extended-acf#location
     */
    public static function getLocation(): Traversable
    {
        yield Location::where('post_type', '==', 'post');
    }
}



namespace App\Admin;

use Adeliom\Lumberjack\Admin\AbstractAdmin;
use Traversable;

class OptionsAdmin extends AbstractAdmin
{
    public const TITLE = "Options";
    public const IS_OPTION_PAGE = true;
    
    /**
     * User defined ACF fields
     * @see https://github.com/vinkla/extended-acf#fields
     * @return \Traversable|null
     */
    public static function getFields(): ?\Traversable
    {
        yield Text::make('Gtag code', 'gtag');
    }
}



namespace App\Block;

use Adeliom\Lumberjack\Admin\AbstractBlock;
use Extended\ACF\Fields\WysiwygEditor;use Traversable;

class WysiwygBlock extends AbstractBlock
{

    public const NAME = "wysiwyg";
    public const TITLE = "Text Editor";
    public const DESCRIPTION = "Simple HTML content";

    /**
     * User defined ACF fields
     * @see https://github.com/vinkla/extended-acf#fields
     * @return \Traversable|null
     */
    public static function getFields(): ?\Traversable
    {
        yield WysiwygEditor::make('HTML Content', 'content');
    }
}


//web/app/themes/YOUR_THEME/config/gutenberg.php
return [
   'categories' => [
        [
            'slug' => 'content',
            'title' => __('Content'),
            'icon' => null,
        ]
    ]
];


//web/app/themes/YOUR_THEME/config/gutenberg.php
return [
    ...
    'settings' => [
        ...
        "disable_blocks" => false
    ],
    ...
];


//web/app/themes/YOUR_THEME/config/gutenberg.php
return [
    ...
    'settings' => [
        ...
        "disable_blocks" => false
    ],
    ...
];


//web/app/themes/YOUR_THEME/config/gutenberg.php
return [
    ...
    'templates' => [
        ...
        "KEY" => [...]
    ],
    ...
];

[
    "enabled" => true,
    "blocks" => [],
    "template" => null,
    "template_lock" => null
]
bash
composer configuration file
cp vendor/agence-adeliom/lumberjack-admin/config/gutenberg.php web/app/themes/YOUR_THEME/config/gutenberg.php