ACF_Repeater_Table::thead
Renders the table head.
Метод класса: ACF_Repeater_Table{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$ACF_Repeater_Table = new ACF_Repeater_Table(); $ACF_Repeater_Table->thead();
Список изменений
| С версии 6.0.0 | Введена. |
Код ACF_Repeater_Table::thead() ACF Repeater Table::thead ACF 6.4.2
<?php
public function thead() {
if ( 'table' !== $this->field['layout'] ) {
return;
}
?>
<thead>
<tr>
<?php if ( $this->show_order ) : ?>
<th class="acf-row-handle"></th>
<?php endif; ?>
<?php
foreach ( $this->sub_fields as $sub_field ) :
// Prepare field (allow sub fields to be removed).
$sub_field = acf_prepare_field( $sub_field );
if ( ! $sub_field ) {
continue;
}
// Define attrs.
$attrs = array(
'class' => 'acf-th',
'data-name' => $sub_field['_name'],
'data-type' => $sub_field['type'],
'data-key' => $sub_field['key'],
);
if ( $sub_field['wrapper']['width'] ) {
$attrs['data-width'] = $sub_field['wrapper']['width'];
$attrs['style'] = 'width: ' . $sub_field['wrapper']['width'] . '%;';
}
// Remove "id" to avoid "for" attribute on <label>.
$sub_field['id'] = '';
?>
<th <?php echo acf_esc_attrs( $attrs ); ?>>
<?php acf_render_field_label( $sub_field ); ?>
<?php acf_render_field_instructions( $sub_field ); ?>
</th>
<?php endforeach; ?>
<?php if ( $this->show_remove ) : ?>
<th class="acf-row-handle"></th>
<?php endif; ?>
</tr>
</thead>
<?php
}