prgfx/neos-linkeditor

Neos Link-Editor extension for editing query arguments for example to edit tracking parameters.

Installs: 153

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Language:TypeScript

Type:neos-package

v0.3.0 2023-10-02 20:42 UTC

This package is auto-updated.

Last update: 2024-10-31 00:34:11 UTC


README

Version

Prgfx.Neos.LinkEditor

Allows configuring inputs for query arguments in the link-editor. Intended for adding tracking parameters.

composer require prgfx/neos-linkeditor

Usage

My.Package:NodeType:
  properties:
    text:
      ui:
        inline:
          editorOptions:
            linking:
              linkAttributes:
                # specify the label for a single query argument
                utm_campaign: Campaign
                # more options can be specified in an object
                utm_source:
                  label: UTM source
                  help: Description for this parameter
                # all labels accept translation IDs
                other:
                  label: My.Package:Main:i18nLabel
                  placeholder: Example value
                # unset attributes or attributes without label are ignored
                ignored_attribute: ~

Group Inputs

In case you have multiple types of inputs, you can group them in a "meaningful" way:

# ...
   linking:
    linkAttributes:
      utm_campaign:
        label: Campaign
        group: tracking

Groups can be configured in the frontend settings:

Prgfx:
  Neos:
    LinkEditor:
      parameterGroups:
        tracking:
          # supports MyPackage:Source:key translation keys as well
          label: Tracking parameters
          # optional; if a value is set in that group, the group will always be expanded
          collapsed: true

The default group is called default, in case you want to overwrite its settings.

Augment Links

For similar use-cases you may want to append additional arguments to links in certain contexts, e.g. set a "utm_source" argument in your email or RSS rendering. For this you can overwrite the Prgfx.Neos.LinkEditor:AdditionalArguments fusion prototype:

prototype(My.Package:RssItem) {
    prototype(Prgfx.Neos.LinkEditor:AdditionalArguments) {
        utm_source = 'rss'
    }
}

The attributes will be appended to links going through Neos.Fusion:UriBuilder, Neos.Neos:NodeUri and Neos.Neos:ConvertUris. You can disable this behavior with the respective settings:

Prgfx:
  Neos:
    LinkEditor:
      augmentLinks:
        NodeUri: true
        UriBuilder: true
        ConvertUris: true

Note

This package overwrites the default LinkEditor to allow passing additional linking options to enable the parameter editor in the inspector editor. You can disable this behavior in the settings:

Neos:
  Neos:
    Ui:
      frontendConfiguration:
        Prgfx.Neos.LinkEditor:
          linkEditor:
            replace: false

See the package settings for more information