i13e/buttoneditor

A plugin for Neos CMS which provides a button editor

Installs: 366

Dependents: 0

Suggesters: 0

Security: 0

Stars: 9

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:neos-package

1.0.6 2023-05-02 05:55 UTC

This package is auto-updated.

Last update: 2024-03-31 08:10:21 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Button editor for Neos CMS

This package provides a new inspector editor displaying it's options as buttons.

Buttons operates like check- or radioboxes.

Align

Installation

Run composer require i13e/buttoneditor.

Usage

Use the new editor in your properties

I13e.Package:Content.Text:
  properties:
    align:
      # ButtonEditor supports "string" and "array"
      type: string
      defaultValue: left
      ui:
        label: 'Align'
        inspector:
          editor: I13e.ButtonEditor/ButtonEditor
          editorOptions:
            # Allow all buttons to be deselected
            # boolean, default: false
            allowEmpty: false
            # Allow multiple buttons to be active
            # If set to true also use `type` array
            # boolean, default: false
            multiple: false
            # Disable all buttons
            # boolean, default: false
            disabled: false
            values:
              left:
                label: i18n
                icon: align-left
              center:
                label: i18n
                icon: align-center
              right:
                label: i18n
                icon: align-right
              justify:
                label: i18n
                icon: align-justify
                # An alternative icon for the active state
                iconActive: align-justify
                # Disable a single option
                disabled: true
            
            # ---
            # Optionally use a data source:
            # 
            # If `dataSourceIdentifier` or `dataSourceUri` is defined, the `values` from above will be ignored
            dataSourceIdentifier: 'i13e-some-datasource'
            dataSourceUri: 'some/custom-route'
            dataSourceAdditionalData:
              group: 'align'
            dataSourceDisableCaching: false

As you may have realized, the configuration is nearly completely compatible with the default SelectBoxEditor.

Examples

Basic example from above

Align

Multiple with allowEmpty

editorOptions:
  allowEmpty: true
  multiple: true
  values:
    # define your own

Format

Multiple with allowEmpty:

editorOptions:
  allowEmpty: true
  values:
    toggle:
      label: i18n
      icon: toggle-off
      iconActive: toggle-on

Toggle

Known issues

  • Although the ButtonEditor works with Neos 5.3 it does not support automatic label i18n handling. With Neos 5.3 please use full translation paths.

Contribution

If you'd like to contribute simply create a pull-request.

Proudly developed in the Hanover Region