field, array(
'max' => 0,
'min' => 0,
'button_title' => '',
) );
if ( preg_match( '/'. preg_quote( '['. $this->field['id'] .']' ) .'/', $this->unique ) ) {
echo '
'. esc_html__( 'Error: Field ID conflict.', 'sakurairo_csf' ) .'
';
} else {
echo $this->field_before();
echo '';
echo '
';
foreach ( $this->field['fields'] as $field ) {
$field_default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$field_unique = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .'][0]' : $this->field['id'] .'[0]';
Sakurairo_CSF::field( $field, $field_default, '___'. $field_unique, 'field/repeater' );
}
echo '
';
echo '
';
echo '
';
echo '';
echo '';
echo '';
echo '
';
echo '
';
echo '
';
echo '';
if ( ! empty( $this->value ) && is_array( $this->value ) ) {
$num = 0;
foreach ( $this->value as $key => $value ) {
echo '
';
echo '
';
foreach ( $this->field['fields'] as $field ) {
$field_unique = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .']['. $num .']' : $this->field['id'] .'['. $num .']';
$field_value = ( isset( $field['id'] ) && isset( $this->value[$key][$field['id']] ) ) ? $this->value[$key][$field['id']] : '';
Sakurairo_CSF::field( $field, $field_value, $field_unique, 'field/repeater' );
}
echo '
';
echo '
';
echo '
';
echo '';
echo '';
echo '';
echo '
';
echo '
';
echo '
';
$num++;
}
}
echo '
';
echo ''. esc_html__( 'You cannot add more.', 'sakurairo_csf' ) .'
';
echo ''. esc_html__( 'You cannot remove more.', 'sakurairo_csf' ) .'
';
echo ''. $args['button_title'] .'';
echo $this->field_after();
}
}
public function enqueue() {
if ( ! wp_script_is( 'jquery-ui-sortable' ) ) {
wp_enqueue_script( 'jquery-ui-sortable' );
}
}
}
}