ACF_Assets::enqueue_scripts()publicACF 5.9.0

Enqueues and localizes scripts.

{} Это метод класса: ACF_Assets{}

Возвращает

null. Ничего.

Использование

$ACF_Assets = new ACF_Assets();
$ACF_Assets->enqueue_scripts();

Список изменений

С версии 5.9.0 Введена.

Код ACF_Assets::enqueue_scripts() ACF 5.10.2

public function enqueue_scripts() {

	// Enqueue input scripts.
	if ( in_array( 'input', $this->enqueue ) ) {
		wp_enqueue_script( 'acf-input' );
		wp_enqueue_style( 'acf-input' );
	}

	// Enqueue media scripts.
	if ( in_array( 'uploader', $this->enqueue ) ) {
		$this->enqueue_uploader();
	}

	// Localize text.
	acf_localize_text(
		array(

			// Tooltip
			'Are you sure?' => __( 'Are you sure?', 'acf' ),
			'Yes'           => __( 'Yes', 'acf' ),
			'No'            => __( 'No', 'acf' ),
			'Remove'        => __( 'Remove', 'acf' ),
			'Cancel'        => __( 'Cancel', 'acf' ),
		)
	);

	// Localize "input" text.
	if ( wp_script_is( 'acf-input' ) ) {
		acf_localize_text(
			array(

				// Unload
				'The changes you made will be lost if you navigate away from this page' => __( 'The changes you made will be lost if you navigate away from this page', 'acf' ),

				// Validation
				'Validation successful'       => __( 'Validation successful', 'acf' ),
				'Validation failed'           => __( 'Validation failed', 'acf' ),
				'1 field requires attention'  => __( '1 field requires attention', 'acf' ),
				'%d fields require attention' => __( '%d fields require attention', 'acf' ),

				// Other
				'Edit field group'            => __( 'Edit field group', 'acf' ),
			)
		);

		/**
		 * Fires during "admin_enqueue_scripts" when ACF scripts are enqueued.
		 *
		 * @since   5.6.9
		 *
		 * @param   void
		 */
		do_action( 'acf/input/admin_enqueue_scripts' );
	}

	/**
	 * Fires during "admin_enqueue_scripts" when ACF scripts are enqueued.
	 *
	 * @since   5.6.9
	 *
	 * @param   void
	 */
	do_action( 'acf/admin_enqueue_scripts' );
	do_action( 'acf/enqueue_scripts' );

	// Filter i18n translations that differ from English and localize script.
	$text = array();
	foreach ( $this->text as $k => $v ) {
		if ( str_replace( '.verb', '', $k ) !== $v ) {
			$text[ $k ] = $v;
		}
	}
	if ( $text ) {
		wp_localize_script( 'acf', 'acfL10n', $text );
	}
}