Editor::field_markup()

Description #

Field markup.

Changelog #

VersionDescription
4.1.8Introduced.

Source #

File: lib/form/class-editor.php

	public function field_markup() {
		parent::field_markup();
		$args = $this->get( 'editor_args', array() );

		$settings = array(
			'textarea_rows' => 10,
			'tinymce'       => array(
				'content_css'      => ap_get_theme_url( 'css/editor.css' ),
				'wp_autoresize_on' => true,
				'statusbar'        => false,
				'codesample'       => true,
				'anspress'         => true,
				'toolbar1'         => 'bold,italic,underline,strikethrough,bullist,numlist,link,unlink,blockquote,fullscreen,apcode',
				'toolbar2'         => '',
				'toolbar3'         => '',
				'toolbar4'         => '',
			),
			'quicktags'     => false,
			'media_buttons' => false,
			'textarea_name' => $this->field_name,
		);

		if ( true === $args['quicktags'] ) {
			$settings['tinymce'] = false;
		}

		$editor_args = wp_parse_args( $this->get( 'editor_args' ), $settings );

		/**
		 * Can be used to modify wp_editor settings.
		 *
		 * @var array
		 * @since 2.0.1
		 */
		$editor_args = apply_filters( 'ap_pre_editor_settings', $editor_args );

		$this->add_html( '<div class="ap-editor">' );
		$this->image_button();

		/**
		 * Filter value before passing it to wp editor.
		 *
		 * @param string $value Value.
		 *
		 * @since 4.1.8
		 */
		$value = apply_filters( 'ap_editor_pre_value', $this->value() );

		ob_start();
		wp_editor( $value, $this->id(), $editor_args );
		$this->add_html( ob_get_clean() );

		$this->add_html( '</div>' );

		/** This action is documented in lib/form/class-input.php */
		do_action_ref_array( 'ap_after_field_markup', array( &$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