acf_field__group::render_field_table()publicACF 5.4.0

render_field_table

description

@type    function

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

Хуков нет.

Возвращает

$post_id. (int)

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

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

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

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

Код acf_field__group::render_field_table() ACF 5.10.2

<?php
function render_field_table( $field ) {

	?>
<table class="acf-table">
	<thead>
<tr>
	<?php
	foreach ( $field['sub_fields'] as $sub_field ) :

		// prepare field (allow sub fields to be removed)
		$sub_field = acf_prepare_field( $sub_field );

		// bail ealry if no field
		if ( ! $sub_field ) {
			continue;
		}

		// vars
		$atts              = array();
		$atts['class']     = 'acf-th';
		$atts['data-name'] = $sub_field['_name'];
		$atts['data-type'] = $sub_field['type'];
		$atts['data-key']  = $sub_field['key'];

		// Add custom width
		if ( $sub_field['wrapper']['width'] ) {

			$atts['data-width'] = $sub_field['wrapper']['width'];
			$atts['style']      = 'width: ' . $sub_field['wrapper']['width'] . '%;';

		}

		?>
	<th <?php acf_esc_attr_e( $atts ); ?>>
		<?php acf_render_field_label( $sub_field ); ?>
		<?php acf_render_field_instructions( $sub_field ); ?>
	</th>
	<?php endforeach; ?>
</tr>
	</thead>
	<tbody>
<tr class="acf-row">
	<?php

	foreach ( $field['sub_fields'] as $sub_field ) {

		acf_render_field_wrap( $sub_field, 'td' );

	}

	?>
</tr>
	</tbody>
</table>
	<?php

}