daun/statamic-multisite-field 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

daun/statamic-multisite-field

Composer 安装命令:

composer require daun/statamic-multisite-field

包简介

Fieldtype for storing localized values in non-localizable contexts

README 文档

README

Fieldtype for entering localized values in places Statamic doesn't usually localize — asset blueprints, form configs, globals without localization, and other "site-less" contexts.

It wraps a single field of any type, stores one value per site, and augments to the current site's value on the frontend.

Installation

composer require daun/statamic-multisite-field

Usage

Add a multisite field to a blueprint and configure the field it wraps. Define display and instructions on the root multisite field, not the wrapped field.

caption:
  type: multisite
  display: 'Caption'
  instructions: 'Shown below the image'
  field:
    type: text

Frontend Display

Values are augmented to the current site's value on the frontend. Use like any other field.

{{ caption }}

Storage

Values are stored keyed by site handle.

caption:
  en: 'Welcome home'
  fr: 'Bienvenue chez vous'

Existing fields

Upgrading an existing field (e.g. text or url) to multisite just works: previously stored values are treated as the default site's value and upgraded to the per-site format on the next save.

Field Configuration

Option Default Description
field The wrapped field's configuration (required).
layout tabs How to display the sites: one at a time behind a switcher (tabs, bottom, start, end) or all at once (stack).
inherit true Fall back to the default site's value when a site has no own value.
fallback Handle of a sibling field in the same publish context to fall back to when the default site has no value.

Site Switcher Layout

In the control panel, the field shows the input for a single site at a time. Switch sites with the tabs above the field. All multisite fields on a page switch together, so you always see one consistent site across the form.

The layout field config controls how to switch sites.

Tabs

The default value of tabs shows a tab bar above the field.

Button Groups

The values bottom, start or end show a button group next to the field.

Stacked

The value stack shows all sites in a single column, without a switcher.

Inheritance

A multisite field can inherit from a sibling in the same blueprint, in addition to inheriting between its own sites. This is useful for adding optional per-site translations of a field that already has a default value.

display:
  type: text

display_i18n:
  type: multisite
  inherit: true
  fallback: display
  field:
    type: text

Global Site Switcher

With many multisite fields on one form, the per-field switchers add up. Add a multisite_switcher field to the blueprint to show a single global switcher that controls all multisite fields. Any multisite fields on the same form will then hide their own switchers.

Choose between three layouts: tabs, buttons or dropdown.

site_switcher:
  type: multisite_switcher
  layout: tabs

The switcher is a display-only field — it stores no data.

Limitations

  • Listings and previews use the default site's value.
  • Field conditions targeting the wrapped field are not supported.

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固