定制 folivoro/layotter-bridge 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

folivoro/layotter-bridge

Composer 安装命令:

composer require folivoro/layotter-bridge

包简介

Integrates the Layotter plugin to folivoro/sloth.

README 文档

README

Sloth Logo

Total Downloads Latest Stable Version License CI

Folivoro Layotter Bridge

Integrates the Layotter page builder plugin with folivoro/sloth.

Layotter is a WordPress page builder plugin originally developed by Dennis Hingst at Quäntchen + Glück. It provides structured content editing through rows, columns, and elements — and is one of the core inspirations for Sloth itself.

Note
Layotter must be installed and activated as a WordPress plugin for this integration to work.

Installation

composer require folivoro/layotter-bridge

Usage

Enabling Layotter for a post type

Set $layotter on your Sloth model:

class Project extends Model
{
    // Enable with default settings
    public static $layotter = true;

    // Enable with custom row layouts
    public static $layotter = [
        'allowed_row_layouts' => ['full', 'half', 'third'],
    ];

    // Disable (default)
    public static $layotter = false;
}

Turning a module into a Layotter element

Set $layotter on your module with an ACF field group key and display settings:

class HeroModule extends Module
{
    public static $layotter = [
        'field_group' => 'group_hero',
        'title'       => 'Hero',
        'description' => 'Full-width hero section',
        'icon'        => 'star',
    ];
}

The bridge registers the module as a Layotter element automatically. The ACF fields defined by field_group are passed to the module as view variables when rendered.

Backend preview

By default, Layotter shows a table of field values as the backend preview. To use a custom Twig template instead, create a _layotter variant of your module template:

theme/views/module/hero.twig              # Frontend template
theme/views/module/hero_layotter.twig     # Backend preview template

Custom views

Override the default markup for elements, columns, rows, or the entire post layout by placing Twig templates in your theme:

theme/views/layotter/element/default.twig
theme/views/layotter/column/default.twig
theme/views/layotter/row/default.twig
theme/views/layotter/post/default.twig

Each view receives the rendered content and contextual options (post_options, row_options, col_options, etc.).

Column classes

Column classes default to a 12-column Bootstrap grid (col-lg-1 through col-lg-12). Publish the config and override via custom_classes:

wp sloth vendor:publish --provider="Folivoro\LayotterBridge\LayotterBridgeServiceProvider" --tag=config
// config/layotter.php
return [
    'row_layouts' => ['full', '1/2', '1/3', '2/3'],
    'custom_classes' => [
        '1/2' => 'col-md-6',
        '1/3' => 'col-md-4',
        '2/3' => 'col-md-8',
    ],
];

Configuration reference

Key Type Description
row_layouts array Restrict available row layouts globally
custom_classes array Override default Bootstrap column CSS classes
prepare_fields bool Whether to prepare ACF fields before rendering elements

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固