aryehraber/statamic-uuid 问题修复 & 功能扩展

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

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

aryehraber/statamic-uuid

最新稳定版本:v2.3.0

Composer 安装命令:

composer require aryehraber/statamic-uuid

包简介

One of its kind; unlike anything else

README 文档

README

One of its kind; unlike anything else

This fieldtype auto-generates UUIDs for empty fields. This can be useful if you need unique, persistent IDs for each row in a Replicator, for example.

Installation

Install the addon via composer:

composer require aryehraber/statamic-uuid

Publish the fieldtype assets:

php please vendor:publish --tag=uuid

Usage

Inside your blueprint, simply use type: uuid and a UUID will be generated for that field if it's blank. Already occupied fields (including previously generated UUIDs) will not be overwritten.

Settings

Name Default Description
hidden false Hide the field from the CP while still generating a UUID.
read_only false Set the input to read-only, stopping the user from editing the field.
id_prefix '' Add a prefix to the ID.
id_type uuid Set the underlying ID generator, options: uuid & nanoid.
alphabet null Set a custom alphabet when using nanoid.
size null Set the max character limit when using nanoid.

Example:

Blueprint

fields:
  -
    handle: sections
    field:
      type: replicator
      sets:
        section:
          fields:
            -
              handle: uuid
              field:
                type: uuid
            -
              handle: fields
              field:
                type: replicator
                sets:
                  value:
                    fields:
                      -
                        handle: uuid
                        field:
                          type: uuid
                          id_type: nanoid
                          alphabet: ABCD1234
                          size: 5

Output

sections:
  -
    uuid: 026fd166-8638-4c21-9e38-730b4ab3d4ea
    type: section
    fields:
      -
        uuid: A4C11
        type: value
  -
    uuid: 4a7ce0b0-0483-42d9-a7b0-ce0201dd9c84
    type: section
    fields:
      -
        uuid: B1CB3
        type: value
      -
        uuid: 41CD1
        type: value

Credits

Originally built at Series Eight, now maintained by Aryeh Raber.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-28