WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

acf_field_flexible_content::render_field_settings() public ACF 3.6

Create extra options for your field. This is rendered when editing a field. The value of $field['name'] can be used (like bellow) to save extra data to the $field

{} Это метод класса: acf_field_flexible_content{}

Хуков нет.

Возвращает

Null. Ничего.

Использование

$acf_field_flexible_content = new acf_field_flexible_content();
$acf_field_flexible_content->render_field_settings( $field );
$field (обязательный)
-

Список изменений

С версии 3.6 Введена.

Код acf_field_flexible_content::render_field_settings() ACF 5.9.1

<?php
function render_field_settings( $field ) {
	
	// load default layout
	if( empty($field['layouts']) ) {
	
		$field['layouts'] = array(
			array()
		);
		
	}
	
	
	// loop through layouts
	foreach( $field['layouts'] as $layout ) {
		
		// get valid layout
		$layout = $this->get_valid_layout( $layout );
		
		
		// vars
		$layout_prefix = "{$field['prefix']}[layouts][{$layout['key']}]";
		
		
?><tr class="acf-field acf-field-setting-fc_layout" data-name="fc_layout" data-setting="flexible_content" data-id="<?php echo $layout['key']; ?>">
<td class="acf-label">
	<label><?php _e("Layout",'acf'); ?></label>
	<ul class="acf-bl acf-fl-actions">
		<li><a class="reorder-layout" href="#" title="<?php _e("Reorder Layout",'acf'); ?>"><?php _e("Reorder",'acf'); ?></a></li>
		<li><a class="delete-layout" href="#" title="<?php _e("Delete Layout",'acf'); ?>"><?php _e("Delete",'acf'); ?></a></li>
		<li><a class="duplicate-layout" href="#" title="<?php _e("Duplicate Layout",'acf'); ?>"><?php _e("Duplicate",'acf'); ?></a></li>
		<li><a class="add-layout" href="#" title="<?php _e("Add New Layout",'acf'); ?>"><?php _e("Add New",'acf'); ?></a></li>
	</ul>
</td>
<td class="acf-input">
	<?php 
		
	acf_hidden_input(array(
		'id'		=> acf_idify( $layout_prefix . '[key]' ),
		'name'		=> $layout_prefix . '[key]',
		'class'		=> 'layout-key',
		'value'		=> $layout['key']
	));
	
	?>
	<ul class="acf-fc-meta acf-bl">
		<li class="acf-fc-meta-label">
			<?php 
			
			acf_render_field(array(
				'type'		=> 'text',
				'name'		=> 'label',
				'class'		=> 'layout-label',
				'prefix'	=> $layout_prefix,
				'value'		=> $layout['label'],
				'prepend'	=> __('Label','acf')
			));
			
			?>
		</li>
		<li class="acf-fc-meta-name">
			<?php 
					
			acf_render_field(array(
				'type'		=> 'text',
				'name'		=> 'name',
				'class'		=> 'layout-name',
				'prefix'	=> $layout_prefix,
				'value'		=> $layout['name'],
				'prepend'	=> __('Name','acf')
			));
			
			?>
		</li>
		<li class="acf-fc-meta-display">
			<div class="acf-input-prepend"><?php _e('Layout','acf'); ?></div>
			<div class="acf-input-wrap">
				<?php 
				
				acf_render_field(array(
					'type'		=> 'select',
					'name'		=> 'display',
					'prefix'	=> $layout_prefix,
					'value'		=> $layout['display'],
					'class'		=> 'acf-is-prepended',
					'choices'	=> array(
						'table'			=> __('Table','acf'),
						'block'			=> __('Block','acf'),
						'row'			=> __('Row','acf')
					),
				));
				
				?>
			</div>
		</li>
		<li class="acf-fc-meta-min">
			<?php
					
			acf_render_field(array(
				'type'		=> 'text',
				'name'		=> 'min',
				'prefix'	=> $layout_prefix,
				'value'		=> $layout['min'],
				'prepend'	=> __('Min','acf')
			));
			
			?>
		</li>
		<li class="acf-fc-meta-max">
			<?php 
			
			acf_render_field(array(
				'type'		=> 'text',
				'name'		=> 'max',
				'prefix'	=> $layout_prefix,
				'value'		=> $layout['max'],
				'prepend'	=> __('Max','acf')
			));
			
			?>
		</li>
	</ul>
	<?php 
	
	// vars
	$args = array(
		'fields'	=> $layout['sub_fields'],
		'parent'	=> $field['ID']
	);
	
	acf_get_view('field-group-fields', $args);
	
	?>
</td>
</tr>
<?php

	}
	// endforeach
	
	
	// min
	acf_render_field_setting( $field, array(
		'label'			=> __('Button Label','acf'),
		'instructions'	=> '',
		'type'			=> 'text',
		'name'			=> 'button_label',
	));
	
	
	// min
	acf_render_field_setting( $field, array(
		'label'			=> __('Minimum Layouts','acf'),
		'instructions'	=> '',
		'type'			=> 'number',
		'name'			=> 'min',
	));
	
	
	// max
	acf_render_field_setting( $field, array(
		'label'			=> __('Maximum Layouts','acf'),
		'instructions'	=> '',
		'type'			=> 'number',
		'name'			=> 'max',
	));
			
}