Giter VIP home page Giter VIP logo

sitegeist.silhouettes's Introduction

Sitegeist.Silhouettes

Neos 7.0 includes the features of Sitegeist.Silhouettes as NodeType presets. This package will be abandoned in favor of that eventually!

Centralized property configuration for the Neos.ContentRepository

It is common that properties in various NodeTypes are expected to behave identically. This is usually achieved with mixins but those are bound to a fixed property name do not cover the case where properties with different names share similarities.

The Sitegeist.Silhouettes package uses preconfigured property-configurations from the settings in multiple NodeTypes. This adds a way to centralize property-configuration for cases where mixins are not sufficient and settings shall be synchronized betweeen properties with different names.

It is also possible to create silhouettes for childNode constraint configurations, e.g. to apply the same centralized constraints to different childNodes following the dry principle. This can also be useful when using a single NodeType package in different neos instances where the constraints may differcenate.

The settings from the configured silhouette are merged with the configuration that is found in the nodeType with the local configuration taking precedence over the silhouette.

Authors & Sponsors

The development and the public-releases of this package is generously sponsored by our employer http://www.sitegeist.de.

Usage

Settings.yaml

Sitegeist:
  Silhouettes:
    properties:
      vendor:
        text:
          block:
            type: string
            defaultValue: ''
            ui:
              inlineEditable: true
              inline:
                editorOptions:
                  placeholder: '(( text block ))'
                  autoparagraph: true
                  linking:
                    anchor: true
                    title: true
                    relNofollow: false
                    targetBlank: false
                  formatting:
                    strong: true
                    em: true
                    u: false
                    underline: false
                    strikethrough: false
                    sub: false
                    sup: false
                    del: false
                    p: true
                    h1: false
                    h2: false
                    h3: false
                    h4: false
                    h5: false
                    h6: false
                    pre: false
                    removeFormat: true
                    left: false
                    right: false
                    center: false
                    justify: false
                    table: false
                    ol: false
                    ul: false
                    a: true
  
      childNodes:
        vendor:
          defaultConstraints:
            constraints:
              'Neos.Neos:Content': true
              'Neos.NodeTypes.BaseMixins:TitleMixin': true
              'Neos.Demo:Constraint.Content.Carousel': true
              'Neos.Demo:Constraint.Content.Column': false

NodeTypes.yaml

'Vendor.Package:NodeTypeName':
  childNodes:
    column1:
      options:
        silhouette: 'vendor.defaultConstraints'    
    column2:
      options:
        silhouette: 'vendor.defaultConstraints'    
  properties:
    description:
      ui:
        label: 'Description'
        inline:
          editorOptions:
            placeholder: 'please add description ... '
      options:
        silhouette: 'vendor.text.block'

Predefined silhouettes

  • text.plain: An inline editable string where no formatting is allowed.
  • text.block: An inline editable string where only inline formatting is enabled.
  • text.free: An inline editable string where all formatting including blocks is allowed.

Installation

Sitegeist.Silhouettes is available via packagist. Add "sitegeist/silhouettes" : "^1.0" to the require section of the composer.json or run composer require sitegeist/silhouettes.

We use semantic-versioning so every breaking change will increase the major-version number.

Contribution

We will gladly accept contributions. Please send us pull requests.

sitegeist.silhouettes's People

Contributors

grebaldi avatar mficzel avatar paavo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sitegeist.silhouettes's Issues

Silhouettes is applied after configuration enrichment, but needs to be applied first

The NodeTypeConfigurationEnrichmentAspect enriches the property configuratiuon with dataType-specific default values. This is triggered via `@Flow\Around("method(Neos\ContentRepository\Domain\Model\NodeType->__construct())").

Sihouettes postprocess is called after the media enrichment and therefore misses the vital defaults.

This is the reason for the following two bugs:
#2 It's not possible to use translations
#3 It's not possible to use ImageInterface as property type

Manual Test Case:
Settings.yaml

Sitegeist:
  Silhouettes:
    properties:
      viennajs:
        image:
          type: Neos\Media\Domain\Model\ImageInterface
          ui:
            label: i18n
            reloadIfChanged: true
            inspector:
              group: 'general'
              position: 50

Test Properties:

  properties:
    image:
      options:
        silhouette: 'viennajs.image'
    imageHalf:
      type: Neos\Media\Domain\Model\ImageInterface
      ui:
        inspector:
          position: 50
      options:
        silhouette: 'viennajs.image'
    imageFull:
      type: Neos\Media\Domain\Model\ImageInterface
      ui:
        label: i18n
        reloadIfChanged: true
        inspector:
          group: 'general'
          position: 50

Expected result for all three cases:

    image:
      type: Neos\Media\Domain\Model\ImageInterface
      ui:
        label: Image
        reloadIfChanged: true
        inspector: { editorOptions: { fileUploadLabel: 'Neos.Neos:Main:choose', maximumFileSize: null, features: { crop: true, upload: true, mediaBrowser: true, resize: false }, crop: { aspectRatio: { options: { square: { width: 1, height: 1, label: Square }, fourFive: { width: 4, height: 5 }, fiveSeven: { width: 5, height: 7 }, twoThree: { width: 2, height: 3 }, fourThree: { width: 4, height: 3 }, sixteenNine: { width: 16, height: 9 } }, enableOriginal: true, allowCustom: true, locked: { width: 0, height: 0 } } } }, typeConverter: Neos\Neos\Ui\TypeConverter\UiDependentImageSerializer, editor: Neos.Neos/Inspector/Editors/ImageEditor, group: general, position: 50 }

Actual result:

    image:
      type: Neos\Media\Domain\Model\ImageInterface
      ui:
        label: i18n
        reloadIfChanged: true
        inspector: { group: general, position: 50 }
      options:
        silhouette: viennajs.image
    imageHalf:
      type: Neos\Media\Domain\Model\ImageInterface
      ui:
        label: i18n
        reloadIfChanged: true
        inspector: { group: general, position: 50, editorOptions: { fileUploadLabel: 'Neos.Neos:Main:choose', maximumFileSize: null, features: { crop: true, upload: true, mediaBrowser: true, resize: false }, crop: { aspectRatio: { options: { square: { width: 1, height: 1, label: Square }, fourFive: { width: 4, height: 5 }, fiveSeven: { width: 5, height: 7 }, twoThree: { width: 2, height: 3 }, fourThree: { width: 4, height: 3 }, sixteenNine: { width: 16, height: 9 } }, enableOriginal: true, allowCustom: true, locked: { width: 0, height: 0 } } } }, typeConverter: Neos\Neos\Ui\TypeConverter\UiDependentImageSerializer, editor: Neos.Neos/Inspector/Editors/ImageEditor }
      options:
        silhouette: viennajs.image
    imageFull:
      type: Neos\Media\Domain\Model\ImageInterface
      ui:
        label: 'ViennaJS.Site:NodeTypes.Document.Event:properties.imageFull'
        reloadIfChanged: true
        inspector: { editorOptions: { fileUploadLabel: 'Neos.Neos:Main:choose', maximumFileSize: null, features: { crop: true, upload: true, mediaBrowser: true, resize: false }, crop: { aspectRatio: { options: { square: { width: 1, height: 1, label: Square }, fourFive: { width: 4, height: 5 }, fiveSeven: { width: 5, height: 7 }, twoThree: { width: 2, height: 3 }, fourThree: { width: 4, height: 3 }, sixteenNine: { width: 16, height: 9 } }, enableOriginal: true, allowCustom: true, locked: { width: 0, height: 0 } } } }, typeConverter: Neos\Neos\Ui\TypeConverter\UiDependentImageSerializer, editor: Neos.Neos/Inspector/Editors/ImageEditor, group: general, position: 50 }

Feature: Use multiple Silhouettes

I'd love to have multiple Silhouettes for one single property.
Or is there already a way @mficzel ?

    image:
      options:
        silhouette:
          - 'vendor.image.square'
          - 'vendor.message.sync'

It's not possible to use ImageInterface as property type

The use of Neos\Media\Domain\Model\ImageInterface as property type results in a Missing editor definition error.

Sitegeist:
  Silhouettes:
    properties:
      vendor:
        image:
          plain:
            type: Neos\Media\Domain\Model\ImageInterface
            ui:
              reloadIfChanged: true
              inspector:
                group: 'image'
                position: 10
  properties:
    image:
      ui:
        label: i18n
        inspector:
          group: 'image'
          position: 10
      options:
        silhouette: 'vendor.image.plain'

Bildschirmfoto 2019-05-15 um 21 18 09

Inherit from another Silhouette

Is there a way, to inherit from another Silhouette?
Maybe @mficzel has an idea?

Sitegeist:
  Silhouettes:
    properties:
      vendor:
        image:

          # vendor.image.plain
          plain:
            type: Neos\Media\Domain\Model\ImageInterface
            ui:
              label: 'Image'
              reloadIfChanged: true
              inspector:
                group: image

          # vendor.image.square
          square:
            # inherit from another silhouette
            options:
              silhouette: 'vendor.image.plain'
            # customize settings
            ui:
              label: 'Image square'

1.1.0 prevents Neos 4.3. from booting

After upgrading to 1.1.0 on Neos 4.3.13 the site will die during bootstrap.

Can you reproduce this? Or is there something wrong with our configuration? Site works fine with 1.0.3

Exception in line 46 of /var/www/Neos/releases/2020-05-15__09-56-36/Data/Temporary/Production/Cache/Code/Flow_Object_Classes/Sitegeist_Silhouettes_ContentRepository_SilhouettesNodeTypePostProcessor.php: Argument 1 passed to Neos\Utility\Arrays::getValueByPath() must be of the type array, null given, called in /var/www/Neos/releases/2020-05-15__09-56-36/Data/Temporary/Production/Cache/Code/Flow_Object_Classes/Sitegeist_Silhouettes_ContentRepository_SilhouettesNodeTypePostProcessor.php on line 46

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.