ACF_Repeater_Table::setup
Sets up the field for rendering.
Method of the class: ACF_Repeater_Table{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->setup();
Changelog
| Since 6.0.0 | Introduced. |
ACF_Repeater_Table::setup() ACF Repeater Table::setup code ACF 6.8.8
private function setup() {
if ( $this->field['collapsed'] ) {
foreach ( $this->sub_fields as &$sub_field ) {
// Add target class.
if ( $sub_field['key'] == $this->field['collapsed'] ) {
$sub_field['wrapper']['class'] .= ' -collapsed-target';
}
}
}
if ( $this->field['max'] ) {
// If max 1 row, don't show order.
if ( 1 == $this->field['max'] ) {
$this->show_order = false;
}
// If max == min, don't show add or remove buttons.
if ( $this->field['max'] <= $this->field['min'] ) {
$this->show_remove = false;
$this->show_add = false;
}
}
if ( empty( $this->field['rows_per_page'] ) ) {
$this->field['rows_per_page'] = 20;
}
if ( (int) $this->field['rows_per_page'] < 1 ) {
$this->field['rows_per_page'] = 20;
}
$this->value = $this->prepare_value();
}