Skip to content

Instantly share code, notes, and snippets.

@tobimori
Created April 21, 2024 16:29
Show Gist options
  • Save tobimori/9d27c7c61bf33536189ca4e6e6b4b9b2 to your computer and use it in GitHub Desktop.
Save tobimori/9d27c7c61bf33536189ca4e6e6b4b9b2 to your computer and use it in GitHub Desktop.

Revisions

  1. tobimori created this gist Apr 21, 2024.
    42 changes: 42 additions & 0 deletions HeadingField.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    <?php

    use tobimori\DreamForm\Fields\Field;

    class HeadingField extends Field
    {
    public static function blueprint(): array
    {
    return [
    'label' => 'Überschrift',
    'preview' => 'heading',
    'wysiwg' => true,
    'fields' => [
    'text' => [
    'label' => t('field.blocks.heading.text'),
    'type' => 'writer',
    'inline' => true,
    'placeholder' => t('field.blocks.heading.placeholder'),
    ],
    'level' => [
    'type' => 'hidden',
    'default' => 'h2'
    ]
    ]
    ];
    }

    public static function hasValue(): bool
    {
    return false;
    }

    public static function group(): string
    {
    return 'cosmetic';
    }

    public static function type(): string
    {
    return 'heading';
    }
    }