__('Advanced Flexible Content'), 'name' => 'acfe_flexible_advanced', 'key' => 'acfe_flexible_advanced', 'instructions' => __('Show advanced Flexible Content settings'), 'type' => 'true_false', 'message' => '', 'default_value' => false, 'ui' => true, 'ui_on_text' => '', 'ui_off_text' => '', )); // Stylised button acf_render_field_setting($field, array( 'label' => __('Stylised Button'), 'name' => 'acfe_flexible_stylised_button', 'key' => 'acfe_flexible_stylised_button', 'instructions' => __('Better actions buttons integration'), 'type' => 'true_false', 'message' => '', 'default_value' => false, 'ui' => true, 'ui_on_text' => '', 'ui_off_text' => '', 'conditional_logic' => array( array( array( 'field' => 'acfe_flexible_advanced', 'operator' => '==', 'value' => '1', ), array( 'field' => 'acfe_flexible_remove_add_button', 'operator' => '!=', 'value' => '1', ), ) ) )); // 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_advanced', 'operator' => '==', 'value' => '1', ), 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_advanced', 'operator' => '==', 'value' => '1', ), array( 'field' => 'acfe_flexible_stylised_button', 'operator' => '!=', 'value' => '1', ), array( 'field' => 'acfe_flexible_hide_empty_message', 'operator' => '!=', 'value' => '1', ) ) ) )); } function wrapper_attributes($wrapper, $field){ // Stylised button if($field['acfe_flexible_stylised_button']){ $wrapper['data-acfe-flexible-stylised-button'] = 1; } // Hide Empty Message if($field['acfe_flexible_hide_empty_message'] || $field['acfe_flexible_stylised_button']){ $wrapper['data-acfe-flexible-hide-empty-message'] = 1; } return $wrapper; } function prepare_layout($layout, $field, $i, $value, $prefix){ // Vars $name = $field['_name']; $key = $field['key']; $l_name = $layout['name']; // Default $icons = array( 'add' => '', 'duplicate' => '', 'delete' => '', 'collapse' => '' ); // Previous ACF Version if(acf_version_compare(acf_get_setting('version'), '<', '5.9')){ acfe_unset($icons, 'duplicate'); } // Filters $icons = apply_filters("acfe/flexible/layouts/icons", $icons, $layout, $field); $icons = apply_filters("acfe/flexible/layouts/icons/name={$name}", $icons, $layout, $field); $icons = apply_filters("acfe/flexible/layouts/icons/key={$key}", $icons, $layout, $field); $icons = apply_filters("acfe/flexible/layouts/icons/name={$name}&layout={$l_name}", $icons, $layout, $field); $icons = apply_filters("acfe/flexible/layouts/icons/key={$key}&layout={$l_name}", $icons, $layout, $field); if(!empty($icons)){ ?>