false, 'acfe_flexible_modal_settings_size' => 'large', 'acfe_flexible_modal_settings_close' => true, 'acfe_flexible_modal_settings_close_label' => '', ); return $field; } /** * defaults_layout * * @param $layout * * @return mixed */ function defaults_layout($layout){ $layout['acfe_flexible_settings'] = false; $layout['acfe_flexible_settings_size'] = false; return $layout; } /** * render_field_settings * * @param $field */ function render_field_settings($field){ acf_render_field_setting($field, array( 'label' => __('Settings Modal', 'acfe'), 'name' => 'acfe_flexible_modal_settings', 'key' => 'acfe_flexible_modal_settings', 'instructions' => __('Display a settings modal for each layouts', 'acfe') . '. ' . '' . __('See documentation', 'acfe') . '', 'type' => 'group', 'layout' => 'block', 'sub_fields' => array( array( 'label' => '', 'name' => 'acfe_flexible_modal_settings_enabled', 'key' => 'acfe_flexible_modal_settings_enabled', 'type' => 'true_false', 'instructions' => '', 'required' => false, 'wrapper' => array( 'class' => 'acfe_width_auto', 'id' => '', ), 'message' => '', 'default_value' => false, 'ui' => true, 'ui_on_text' => '', 'ui_off_text' => '', 'conditional_logic' => false, ), array( 'label' => '', 'name' => 'acfe_flexible_modal_settings_size', 'key' => 'acfe_flexible_modal_settings_size', 'type' => 'select', 'prepend' => '', 'instructions' => false, 'required' => false, 'choices' => array( 'small' => __('Small', 'acfe'), 'medium' => __('Medium', 'acfe'), 'large' => __('Large', 'acfe'), 'xlarge' => __('Extra Large', 'acfe'), 'full' => __('Full', 'acfe'), ), 'default_value' => 'large', 'wrapper' => array( 'width' => '25', 'class' => '', 'id' => '', 'data-acfe-prepend' => __('Default Size', 'acfe'), ), 'conditional_logic' => array( array( array( 'field' => 'acfe_flexible_modal_settings_enabled', 'operator' => '==', 'value' => '1', ) ) ) ), array( 'label' => '', 'name' => 'acfe_flexible_modal_settings_close', 'key' => 'acfe_flexible_modal_settings_close', 'type' => 'select', 'prepend' => '', 'instructions' => false, 'required' => false, 'choices' => array( '1' => __('Enabled', 'acfe'), ), 'allow_null' => true, 'placeholder' => __('Disabled', 'acfe'), 'wrapper' => array( 'width' => '25', 'class' => 'acfe_width_auto', 'id' => '', 'data-acfe-prepend' => __('Close Button', 'acfe'), ), 'conditional_logic' => array( array( array( 'field' => 'acfe_flexible_modal_settings_enabled', 'operator' => '==', 'value' => '1', ) ) ) ), array( 'label' => '', 'name' => 'acfe_flexible_modal_settings_close_label', 'key' => 'acfe_flexible_modal_settings_close_label', 'type' => 'text', 'prepend' => __('Close Label', 'acfe'), 'instructions' => false, 'required' => false, 'default_value' => '', 'placeholder' => __('Close', 'acfe'), 'wrapper' => array( 'width' => '25', 'class' => 'acfe_width_auto', 'id' => '', ), 'conditional_logic' => array( array( array( 'field' => 'acfe_flexible_modal_settings_enabled', 'operator' => '==', 'value' => '1', ), array( 'field' => 'acfe_flexible_modal_settings_close', 'operator' => '==', 'value' => '1', ) ) ) ), ), 'conditional_logic' => array( array( array( 'field' => 'acfe_flexible_advanced', 'operator' => '==', 'value' => '1', ), ) ), 'wrapper' => array( 'class' => 'acfe-field-setting-flex' ) )); } /** * render_layout_settings * * @param $field * @param $layout * @param $prefix */ function render_layout_settings($field, $layout, $prefix){ if(!$field['acfe_flexible_modal_settings']['acfe_flexible_modal_settings_enabled']){ return; } acf_disable_filters(); $choices = array(); $field_groups = acf_get_field_groups(); if(!empty($field_groups)){ foreach($field_groups as $field_group){ $choices[$field_group['key']] = $field_group['title']; } } acf_enable_filters(); // Title echo ''; acf_render_field_wrap(array( 'label' => __('Settings Modal', 'acfe'), 'type' => 'hidden', 'name' => 'acfe_flexible_settings_label', 'wrapper' => array( 'class' => 'acfe-flexible-field-setting', ) ), 'ul'); echo '