Editor::image_button()

Description #

Image upload button.

Changelog #

VersionDescription
4.1.8Introduced.

Source #

File: lib/form/class-editor.php

	public function image_button() {
		$btn_args = wp_json_encode(
			array(
				'__nonce'   => wp_create_nonce( 'ap_upload_image' ),
				'action'    => 'ap_upload_modal',
				'form_name' => $this->form_name,
			)
		);

		if ( ap_user_can_upload() ) {
			$this->add_html( '<button type="button" class="ap-btn-insertimage ap-btn-small ap-btn mb-10 ap-mr-5" apajaxbtn aponce="false" apquery="' . esc_js( $btn_args ) . '"><i class="apicon-image ap-mr-3"></i>' . __( 'Insert media', 'anspress-question-answer' ) . '</button>' );
		}

		/**
		 * Action trigged after image button before editor.
		 *
		 * @param string $field_name Original name of the field.
		 * @param object $field      Field object.
		 * @since 4.1.8
		 */
		do_action( 'ap_editor_buttons', $this->original_name, $this );
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment