Skip to content

Type – Select

Henner R Setyono edited this page Dec 25, 2019 · 5 revisions

'contentLinkType' => [
  'label' => __( 'Content Link Type' ),
  'type' => 'ct-select',
  'value' => 'type-1',
  'view' => 'text',
  'design' => 'inline',
  'setting' => [ 'transport' => 'postMessage' ],
  'choices' => blocksy_ordered_keys( [
    'type-1' => __( '1 - Normal' ),
    'type-2' => __( '2 - Underline' ),
    'type-3' => __( '3 - Underline on Hover' ),
    'type-4' => __( '4 - Background on Hover' ),
  ] ),
],

blocksy_ordered_keys()

Transforms the associative array into ordered arrays.

You can skip using this function, but your choices need to be in this format:

[
  [ 'key' => 'type-1', 'value' => __( '1 - Normal' ) ],
  [ 'key' => 'type-2', 'value' => __( '2 - Underline' ) ],
  [ 'key' => 'type-3', 'value' => __( '3 - Underline on Hover' ) ],
  [ 'key' => 'type-4', 'value' => __( '4 - Background on Hovver' ) ],
]

Clone this wiki locally