__('Stylised Button'),
'name' => 'acfe_flexible_stylised_button',
'key' => 'acfe_flexible_stylised_button',
'instructions' => __('Better layouts button integration'),
'type' => 'true_false',
'message' => '',
'default_value' => false,
'ui' => true,
'ui_on_text' => '',
'ui_off_text' => '',
));
// Hide Empty Message
acf_render_field_setting($field, array(
'label' => __('Hide Empty Message'),
'name' => 'acfe_flexible_hide_empty_message',
'key' => 'acfe_flexible_hide_empty_message',
'instructions' => __('Hide the empty message box'),
'type' => 'true_false',
'message' => '',
'default_value' => false,
'ui' => true,
'ui_on_text' => '',
'ui_off_text' => '',
'conditional_logic' => array(
array(
array(
'field' => 'acfe_flexible_stylised_button',
'operator' => '!=',
'value' => '1',
),
)
)
));
// Empty Message
acf_render_field_setting($field, array(
'label' => __('Empty Message'),
'name' => 'acfe_flexible_empty_message',
'key' => 'acfe_flexible_empty_message',
'instructions' => __('Text displayed when the flexible field is empty'),
'type' => 'text',
'placeholder' => __('Click the "Add Row" button below to start creating your layout'),
'conditional_logic' => array(
array(
array(
'field' => 'acfe_flexible_stylised_button',
'operator' => '!=',
'value' => '1',
),
array(
'field' => 'acfe_flexible_hide_empty_message',
'operator' => '!=',
'value' => '1',
)
)
)
));
// Layouts thumbnails
acf_render_field_setting($field, array(
'label' => __('Layouts: Thumbnails'),
'name' => 'acfe_flexible_layouts_thumbnails',
'key' => 'acfe_flexible_layouts_thumbnails',
'instructions' => __('Set a thumbnail for each layouts. You must save the field group to apply this setting'),
'type' => 'true_false',
'message' => '',
'default_value' => false,
'ui' => true,
'ui_on_text' => '',
'ui_off_text' => '',
));
// Layouts: Render
acf_render_field_setting($field, array(
'label' => __('Layouts: Render'),
'name' => 'acfe_flexible_layouts_templates',
'key' => 'acfe_flexible_layouts_templates',
'instructions' => __('Set template, style & javascript files for each layouts. This setting is mandatory in order to use get_flexible() function. You must save the field group to apply this setting'),
'type' => 'true_false',
'message' => '',
'default_value' => false,
'ui' => true,
'ui_on_text' => '',
'ui_off_text' => '',
));
// Layouts: Preview
acf_render_field_setting($field, array(
'label' => __('Layouts: Dynamic Preview'),
'name' => 'acfe_flexible_layouts_previews',
'key' => 'acfe_flexible_layouts_previews',
'instructions' => __('Use layouts render settings to display a dynamic preview in the post administration'),
'type' => 'true_false',
'message' => '',
'default_value' => false,
'ui' => true,
'ui_on_text' => '',
'ui_off_text' => '',
'conditional_logic' => array(
array(
array(
'field' => 'acfe_flexible_layouts_templates',
'operator' => '==',
'value' => '1',
)
)
)
));
// Layouts: Placholder
acf_render_field_setting($field, array(
'label' => __('Layouts: Placeholder'),
'name' => 'acfe_flexible_layouts_placeholder',
'key' => 'acfe_flexible_layouts_placeholder',
'instructions' => __('Display a placeholder with a pencil icon, making edition easier'),
'type' => 'true_false',
'message' => '',
'default_value' => false,
'ui' => true,
'ui_on_text' => '',
'ui_off_text' => '',
'conditional_logic' => array(
array(
array(
'field' => 'acfe_flexible_layouts_previews',
'operator' => '==',
'value' => '',
)
)
)
));
// Layouts: Close Button
acf_render_field_setting($field, array(
'label' => __('Layouts: Close Button'),
'name' => 'acfe_flexible_close_button',
'key' => 'acfe_flexible_close_button',
'instructions' => __('Display a close button to collapse the layout'),
'type' => 'true_false',
'message' => '',
'default_value' => false,
'ui' => true,
'ui_on_text' => '',
'ui_off_text' => '',
));
// Layouts: Title Edition
acf_render_field_setting($field, array(
'label' => __('Layouts: Title Edition'),
'name' => 'acfe_flexible_title_edition',
'key' => 'acfe_flexible_title_edition',
'instructions' => __('Allow layout title edition'),
'type' => 'true_false',
'message' => '',
'default_value' => false,
'ui' => true,
'ui_on_text' => '',
'ui_off_text' => '',
));
// Layouts: Copy/Paste
acf_render_field_setting($field, array(
'label' => __('Layouts: Copy/Paste'),
'name' => 'acfe_flexible_copy_paste',
'key' => 'acfe_flexible_copy_paste',
'instructions' => __('Allow copy/paste layouts functions'),
'type' => 'true_false',
'message' => '',
'default_value' => false,
'ui' => true,
'ui_on_text' => '',
'ui_off_text' => '',
));
// Modal: Edition
acf_render_field_setting($field, array(
'label' => __('Layouts Modal: Edition'),
'name' => 'acfe_flexible_modal_edition',
'key' => 'acfe_flexible_modal_edition',
'instructions' => __('Edit layout content in a modal'),
'type' => 'true_false',
'message' => '',
'default_value' => false,
'ui' => true,
'ui_on_text' => '',
'ui_off_text' => '',
));
// Modal: Selection
acf_render_field_setting($field, array(
'label' => __('Layouts Modal: Selection'),
'name' => 'acfe_flexible_modal',
'key' => 'acfe_flexible_modal',
'instructions' => __('Select layouts in a modal'),
'type' => 'group',
'layout' => 'block',
'sub_fields' => array(
array(
'label' => '',
'name' => 'acfe_flexible_modal_enabled',
'key' => 'acfe_flexible_modal_enabled',
'type' => 'true_false',
'instructions' => '',
'required' => false,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'message' => '',
'default_value' => false,
'ui' => true,
'ui_on_text' => '',
'ui_off_text' => '',
'conditional_logic' => false,
),
array(
'label' => '',
'name' => 'acfe_flexible_modal_title',
'key' => 'acfe_flexible_modal_title',
'type' => 'text',
'prepend' => __('Modal Title'),
'placeholder' => 'Add Row',
'instructions' => false,
'required' => false,
'wrapper' => array(
'width' => '35',
'class' => '',
'id' => '',
),
'conditional_logic' => array(
array(
array(
'field' => 'acfe_flexible_modal_enabled',
'operator' => '==',
'value' => '1',
)
)
)
),
array(
'label' => '',
'name' => 'acfe_flexible_modal_col',
'key' => 'acfe_flexible_modal_col',
'type' => 'select',
'prepend' => '',
'instructions' => false,
'required' => false,
'choices' => array(
'1' => '1 column',
'2' => '2 columns',
'3' => '3 columns',
'4' => '4 columns',
'5' => '5 columns',
'6' => '6 columns',
),
'default_value' => '4',
'wrapper' => array(
'width' => '15',
'class' => '',
'id' => '',
),
'conditional_logic' => array(
array(
array(
'field' => 'acfe_flexible_modal_enabled',
'operator' => '==',
'value' => '1',
)
)
)
),
array(
'label' => '',
'name' => 'acfe_flexible_modal_categories',
'key' => 'acfe_flexible_modal_categories',
'type' => 'true_false',
'message' => __('Categories'),
'instructions' => false,
'required' => false,
'wrapper' => array(
'width' => '25',
'class' => '',
'id' => '',
),
'conditional_logic' => array(
array(
array(
'field' => 'acfe_flexible_modal_enabled',
'operator' => '==',
'value' => '1',
)
)
)
),
)
));
// Layouts: Force State
acf_render_field_setting($field, array(
'label' => __('Layouts: Force State'),
'name' => 'acfe_flexible_layouts_state',
'key' => 'acfe_flexible_layouts_state',
'instructions' => __('Force layouts to be collapsed or opened'),
'type' => 'select',
'allow_null' => true,
'choices' => array(
'collapse' => 'Collapsed',
'open' => 'Opened',
),
'conditional_logic' => array(
array(
array(
'field' => 'acfe_flexible_modal_edition',
'operator' => '!=',
'value' => '1',
)
)
)
));
// Layouts: Remove Collapse
acf_render_field_setting($field, array(
'label' => __('Layouts: Remove Collapse'),
'name' => 'acfe_flexible_layouts_remove_collapse',
'key' => 'acfe_flexible_layouts_remove_collapse',
'instructions' => __('Remove collapse action'),
'type' => 'true_false',
'message' => '',
'default_value' => false,
'ui' => true,
'ui_on_text' => '',
'ui_off_text' => '',
'conditional_logic' => array(
array(
array(
'field' => 'acfe_flexible_modal_edition',
'operator' => '!=',
'value' => '1',
),
array(
'field' => 'acfe_flexible_layouts_state',
'operator' => '==',
'value' => 'open',
)
)
)
));
}
add_action('acf/render_field', 'acfe_flexible_layouts_settings_before', 0);
function acfe_flexible_layouts_settings_before($field){
if($field['_name'] !== 'label' || stripos($field['name'], '[layouts]') === false)
return;
echo '';
acf_render_field_wrap(array(
'label' => __('Settings'),
'type' => 'hidden',
'name' => 'acfe_flexible_settings_label'
), 'ul');
echo '