Repeatable::field_markup()
Description #
Field markup.
Source #
File: lib/form/class-repeatable.php
public function field_markup() {
parent::field_markup();
$this->add_html( '<div class="ap-fieldrepeatable-c" data-role="ap-repeatable" data-args="">' );
$this->add_html( $this->child->generate_fields() );
$add_button_args = wp_json_encode(
array(
'action' => 'ap_repeatable_field',
'form_name' => $this->form_name,
'field_name' => $this->field_name,
'field_id' => sanitize_title( $this->field_name ),
'__nonce' => wp_create_nonce( 'repeatable-field' ),
)
);
// translators: %s is field label.
$this->add_html( '<a class="ap-btn ap-repeatable-add" href="#" apquery="' . esc_js( $add_button_args ) . '">' . sprintf( __( 'Add More %s', 'anspress-question-answer' ), $this->get( 'label' ) ) . '</a>' );
$this->add_html( '<input name="' . sanitize_title( $this->field_name ) . '-groups" value="' . $this->total_items . '" type="hidden" />' );
$this->add_html( '<input name="' . sanitize_title( $this->field_name ) . '-nonce" value="' . wp_create_nonce( $this->field_name . $this->total_items ) . '" type="hidden" />' );
$this->add_html( '</div>' );
/** This action is documented in lib/form/class-input.php */
do_action_ref_array( 'ap_after_field_markup', array( &$this ) );
}
Expand full source code Collapse full source code View on GitHub: lib/form/class-repeatable.php:155
Add your comment