acf_field_repeater::render_field_settings()publicACF 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_repeater{}

Хуков нет.

Возвращает

null. Ничего (null).

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

$acf_field_repeater = new acf_field_repeater();
$acf_field_repeater->render_field_settings( $field );
$field(массив) (обязательный)
An array holding all the field's data.

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

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

Код acf_field_repeater::render_field_settings() ACF 6.0.4

<?php
function render_field_settings( $field ) {
	$args                = array(
		'fields'      => $field['sub_fields'],
		'parent'      => $field['ID'],
		'is_subfield' => true,
	);
	$supports_pagination = ( empty( $field['parent_repeater'] ) && empty( $field['parent_layout'] ) );
	?>
	<div class="acf-field acf-field-setting-sub_fields" data-setting="repeater" data-name="sub_fields">
		<div class="acf-label">
			<label><?php _e( 'Sub Fields', 'acf' ); ?></label>
			<p class="description"></p>		
		</div>
		<div class="acf-input acf-input-sub">
			<?php

			acf_get_view( 'field-group-fields', $args );

			?>
		</div>
	</div>
	<?php
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Layout', 'acf' ),
			'instructions' => '',
			'class'        => 'acf-repeater-layout',
			'type'         => 'radio',
			'name'         => 'layout',
			'layout'       => 'horizontal',
			'choices'      => array(
				'table' => __( 'Table', 'acf' ),
				'block' => __( 'Block', 'acf' ),
				'row'   => __( 'Row', 'acf' ),
			),
		)
	);

	if ( $supports_pagination ) {
		acf_render_field_setting(
			$field,
			array(
				'label'        => __( 'Pagination', 'acf' ),
				'instructions' => __( 'Useful for fields with a large number of rows.', 'acf' ),
				'class'        => 'acf-repeater-pagination',
				'type'         => 'true_false',
				'name'         => 'pagination',
				'ui'           => 1,
			)
		);

		acf_render_field_setting(
			$field,
			array(
				'label'        => __( 'Rows Per Page', 'acf' ),
				'instructions' => __( 'Set the number of rows to be displayed on a page.', 'acf' ),
				'class'        => 'acf-repeater-pagination-num-rows',
				'type'         => 'number',
				'name'         => 'rows_per_page',
				'placeholder'  => 20,
				'ui'           => 1,
				'min'          => 1,
				'conditions'   => array(
					'field'    => 'pagination',
					'operator' => '==',
					'value'    => 1,
				),
			)
		);
	}
}