Skip to content

Latest commit

 

History

History
executable file
·
435 lines (303 loc) · 6.65 KB

abe-attributes.md

File metadata and controls

executable file
·
435 lines (303 loc) · 6.65 KB

Abe attributes

abe tags can own many attributes.

For example the type text, some are required and other are optional:

{{abe type='text' key='text_key'}}

type and key are always required for all content type.

Type of abe content

Other attributes

tab (String)

Default: "default"

tab="NameOfTheTab"

Html input will be displayed into the tab NameOfTheTab.

Allowed:

  • CamelCase
  • Underscore
  • Spaces
  • Special charactères

key (String)

Default: ""

key="keyData"

The key used into json file.

Allowed:

  • CamelCase
  • Underscore
  • Dot

Examples:

{{abe type='text' key='title'}}
{
    "title": "value"
}
{{abe type='text' key='blog.title'}}
{
    "blog": {
        "title": "value"
    }
}

You can use dot json for keys the result will create json value when the data is saved

mypage.content.title.value as key will output

{"mypage": {"content": {"title": {"value": ""}}}}

type (String)

Default: "text"

type="text"

Result:

MacDown Screenshot

Look at all abe type here

autocomplete (Boolean)

Default: null

autocomplete="true"

JSON example for autocomplete:

[
    {
        "id": 1,
        "name": "test 1",
        "lang": "de"
    },
    {
        "id": 2,
        "name": "test 2",
        "lang": "fr"
    },
    {
        "id": 3,
        "name": "test 3",
        "lang": "es"
    }
]

MacDown Screenshot

For Abe type data, display input form autocomplete into admin.

desc (String)

Default: ""

desc="some description for the contributor"

The admin description over the input.

Allowed:

  • CamelCase
  • Underscore
  • Spaces
  • Special charactères

display (String)

Default: null

display="variable"

For Abe type data (autocomplete true or false).

Example:

display="{{name}}"

JSON:

[
    {
        "id": 1,
        "name": "test 1",
        "lang": "de"
    },
    {
        "id": 2,
        "name": "test 2",
        "lang": "fr"
    },
    {
        "id": 3,
        "name": "test 3",
        "lang": "es"
    }
]

The autocomplete value visible under the input will use name from JSON:

  • test 1
  • test 2
  • test 3

Autocomplete 1

Multiple variables are allowed for example with our JSON:

display="{{name}} - {{lang}}"
  • test 1 - de
  • test 2 - fr
  • test 3 - es

Autocomple 2

editable (Boolean)

Default: true

editable="true"

If editable true user can change the value, if not abe will set the values.

max-length (Int)

Default: null

max-length="3"

For Abe type data, array max selection.

min-length (Int)

Default: 0

min-length="1"

For Abe type data, array min selection (if required).

source (String | variables)

Default: null

source="[ source type ]"

See abe type data.

duplicate (Boolean)

Default: true

duplicate="true"

If set to false, when user duplicate a post. The value will not be duplicate into the new post.

Example:

{{abe type='text' key='title' duplicate="false"}}

JSON before duplicate:

{
    "abe_meta": {
        "template": "autocomplete",
        "link": "/test.html",
        "date": "2016-12-15T16:46:22.946Z",
    },
    "title": "test"
}

JSON after duplicate:

Value of title is not filled after duplicate the post with name test-2.html.

{
    "abe_meta": {
        "template": "autocomplete",
        "link": "/test-2.html",
        "date": "2016-12-15T16:46:22.946Z",
    },
    "title": ""
}

reload (Boolean)

Default: false

reload="true"

If reload true, on blur event on the input field the post preview will be reloaded.

required (Boolean)

Default: false

required="true"

If set to true user cannot publish the post without required field.

Example:

{{abe type="text" key="title" required="true"}}

if submited but empty.

Required

visible (Boolean)

Default: true

visible="true"

If visible set to false, the value will not be set into post page (but will be visible on the admin and set into the JSON file).

order (Int)

Default: 0

order="1"

To order the input in the admin:

{{abe type='text' key='title1' desc='title 1' order="2"}}
{{abe type='text' key='title2' desc='title 2' order="1"}}

title1 is added before on the template but without order the result on the admin is inversed.

Order

filetype (String)

Default: ""

filetype="image"

file (String)

Default: ""

file="partial.html"

See abe import.

locale (String | variable)

Default: ""

locale="fr"

prefill (Boolean)

Default: false

prefill="true"

For abe type data, if set to true will add default values.

On the admin side prefill add a reload button on the right.

Prefill

prefill-quantity (Int)

Default: null

prefill-quantity="3"

How many default values to prefill.

value (String)

Default: none

value="default text value"

Add a default value inside input, if the input value changes the default value won't be used anymore unless the value of the input become an empty string.