PHP code example of itineris / sage-flbuilder

1. Go to this page and download the library: Download itineris/sage-flbuilder 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/ */

    

itineris / sage-flbuilder example snippets


class Helper extends AbstractHelper
{
    /**
     * Full path to PostGrid template directory.
     *
     * @return string
     */
    public function getPostGridTemplateDir(): string
    {
        return __DIR__ . '/post-grid';
    }
}

namespace App\Plugins\FLBuilder;

use Itineris\SageFLBuilder\AbstractHelper;

class Helper extends AbstractHelper
{
    // Implement all abstract methods.
}

use App\Plugins\FLBuilder\Helper;
use Itineris\SageFLBuilder\SageFLBuilder;

$sageFLBuilder = new SageFLBuilder(
    new Helper()
);

$sageFLBuilder->init();

namespace App\Plugins\FLBuilder\Modules\RunnerBlock;

use Itineris\SageFLBuilder\AbstractModule;
use Itineris\SageFLBuilder\AbstractHelper;

class RunnerBlock extends AbstractModule
{
    /**
     * Register the module and its form settings.
     * If needed, register a settings form to use in the "form" field type.
     */
    public static function register(): void
    {
        // Invoke `\FLBuilder::register_module` here
        // Invoke `\FLBuilder::register_settings_form` here
    }

    public function __construct()
    {
        /** @var AbstractHelper $helper */
        $helper = sage(AbstractHelper::class);

        parent::__construct([
            'name' => __('Runner block', 'fabric'),
            'description' => __('Runner block widget', 'fabric'),
            'category' => 'Basic',
            'group' => $helper->getModuleGroup(),
            'dir' => __DIR__,
            'url' => $helper->assetPath(__DIR__),
            'icon' => 'layout.svg',
        ]);
    }
}

use App\Plugins\FLBuilder\Helper;
use App\Plugins\FLBuilder\Modules\RunnerBlock\RunnerBlock;
use Itineris\SageFLBuilder\SageFLBuilder;

$sageFLBuilder = new SageFLBuilder(
    new Helper()
);

$sageFLBuilder->add(RunnerBlock::class)
              ->init();

namespace App\Plugins\FLBuilder\Modules\BladeRunnerBlock;

use Itineris\SageFLBuilder\AbstractBladeModule;

class BladeRunnerBlock extends AbstractBladeModule
{
    // Similar to custom PHP module
}

$sageFLBuilder->add(RunnerBlock::class, BladeRunnerBlock::class)
              ->init();

namespace App\Plugins\FLBuilder\Settings;

use Itineris\SageFLBuilder\InitializableInterface;

class MySetting implements InitializableInterface
{
    // Implement all 

$sageFLBuilder->add(RunnerBlock::class, BladeRunnerBlock::class, MySetting::class)
              ->init();

// Example: Enabling `FourOFourThemeLayout`
$sageFLBuilder->add(FourOFourThemeLayout::class)
              ->init();

$sageFLBuilder->add(RunnerBlock::class, BladeRunnerBlock::class, MySetting::class)
              ->remove(FilterBar::class, EventsArchive::class)
              ->init();
bash
➜ tree web/app/themes/greenwich/app/Plugins/FLBuilder
web/app/themes/greenwich/app/Plugins/FLBuilder
├── Helper.php
└── post-grid
    ├── filter-bar-event.blade.php
    ├── filter-bar.php
    ├── post-theme-event.blade.php
    ├── post-theme-product.php
    └── post-theme.blade.php

<sage>/app/Plugins/FLBuilder/Modules
└── RunnerBlock
   ├── RunnerBlock.php
   └── 

<sage>/app/Plugins/FLBuilder/Modules
└── BladeRunnerBlock
   ├── BladeRunnerBlock.php
   └── 
bash
#!/bin/bash

declare -A modules

# Base Modules
modules[fab_accordion]=Accordion
modules[fab_alert]=Alert
modules[fab_breadcrumbs]=Breadcrumbs
modules[fab_button]=Button
modules[fab_content_image]=ContentImage
modules[fab_filter_bar]=FilterBar
modules[fab_gallery]=Gallery
modules[fab_gravity_form]=GravityForm
modules[fab_page_heading]=PageHeading
modules[fab_page_slider]=PageSlider
modules[fab_secondary_nav]=SecondaryNav
modules[fab_table]=Table
modules[fab_testimonial]=Testimonial
modules[fab_video]=Video

# Add project-specific modules here, for example:
# modules[gh_welcome_section]=WelcomeSection

for i in "${!modules[@]}"
do
    echo "$i -> ${modules[$i]}"
    command="wp search-replace '$i' '${modules[$i]}' --dry-run"
    echo "Running $command"
    result=$(eval "${command} 2> /dev/null")
    if [ $? -eq 0 ];then
        echo "${result##*$'\n'}"
        printf "\n------------\n\n"
    else
        echo "Failed!"
        echo $(result | tail -n 1)
        break
    fi

done