Пример #1
0
 function ajax_render_field_settings()
 {
     // vars
     $options = array('nonce' => '', 'parent' => 0, 'field_group' => 0, 'prefix' => '', 'type' => '');
     // load post options
     $options = wp_parse_args($_POST, $options);
     // verify nonce
     if (!wp_verify_nonce($options['nonce'], 'acf_nonce')) {
         die(0);
     }
     // required
     if (!$options['type']) {
         die(0);
     }
     // render options
     $field = acf_get_valid_field(array('type' => $options['type'], 'name' => 'temp', 'prefix' => $options['prefix'], 'parent' => $options['parent'], 'field_group' => $options['field_group']));
     // render
     acf_render_field_settings($field);
     // die
     die;
 }
Пример #2
0
	<div class="settings">			
		<table class="acf-table">
			<tbody>
				<?php 
// label
acf_render_field_wrap(array('label' => __('Field Label', 'acf'), 'instructions' => __('This is the name which will appear on the EDIT page', 'acf'), 'required' => 1, 'type' => 'text', 'name' => 'label', 'prefix' => $field['prefix'], 'value' => $field['label']), 'tr');
// name
acf_render_field_wrap(array('label' => __('Field Name', 'acf'), 'instructions' => __('Single word, no spaces. Underscores and dashes allowed', 'acf'), 'required' => 1, 'type' => 'text', 'name' => 'name', 'prefix' => $field['prefix'], 'value' => $field['name']), 'tr');
// type
acf_render_field_wrap(array('label' => __('Field Type', 'acf'), 'instructions' => '', 'required' => 1, 'type' => 'select', 'name' => 'type', 'prefix' => $field['prefix'], 'value' => $field['type'], 'choices' => acf_get_field_types()), 'tr');
// instructions
acf_render_field_wrap(array('label' => __('Instructions', 'acf'), 'instructions' => __('Instructions for authors. Shown when submitting data', 'acf'), 'type' => 'textarea', 'name' => 'instructions', 'prefix' => $field['prefix'], 'value' => $field['instructions'], 'rows' => 5), 'tr');
// required
acf_render_field_wrap(array('label' => __('Required?', 'acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'required', 'prefix' => $field['prefix'], 'value' => $field['required'], 'choices' => array(1 => __("Yes", 'acf'), 0 => __("No", 'acf')), 'layout' => 'horizontal'), 'tr');
// custom field options
acf_render_field_settings($field);
// load view
acf_get_view('field-group-field-conditional-logic', array('field' => $field));
// wrapper
acf_render_field_wrap(array('label' => __('Wrapper Attributes', 'acf'), 'instructions' => '', 'type' => 'text', 'name' => 'width', 'prefix' => $field['prefix'] . '[wrapper]', 'value' => $field['wrapper']['width'], 'prepend' => __('width', 'acf'), 'append' => '%', 'wrapper' => array('data-name' => 'wrapper')), 'tr');
acf_render_field_wrap(array('label' => '', 'instructions' => '', 'type' => 'text', 'name' => 'class', 'prefix' => $field['prefix'] . '[wrapper]', 'value' => $field['wrapper']['class'], 'prepend' => __('class', 'acf'), 'wrapper' => array('data-append' => 'wrapper')), 'tr');
acf_render_field_wrap(array('label' => '', 'instructions' => '', 'type' => 'text', 'name' => 'id', 'prefix' => $field['prefix'] . '[wrapper]', 'value' => $field['wrapper']['id'], 'prepend' => __('id', 'acf'), 'wrapper' => array('data-append' => 'wrapper')), 'tr');
?>
				<tr class="acf-field acf-field-save">
					<td class="acf-label"></td>
					<td class="acf-input">
						<ul class="acf-hl">
							<li>
								<a class="edit-field acf-button grey" title="<?php 
_e("Close Field", 'acf');
?>