AP_Form_Hooks::image_upload_save( array $values, AnsPressFieldUpload $field )

Description #

Callback for image field in image_upload form.

Parameters #

  • $values
    array (Required) Values.
  • $field
    AnsPressFieldUpload (Required) AnsPress field object.

Changelog #

VersionDescription
4.1.8Introduced.

Source #

File: includes/class-form-hooks.php

	public static function image_upload_save( $values, $field ) {
		$field->save_uploads();

		// Set files in session, so that it can be validated while saving post.
		if ( ! empty( $field->uploaded_files ) ) {
			foreach ( $field->uploaded_files as $new ) {
				anspress()->session->set_file( $new );
			}
		}

		return $field->get_uploaded_files_url();
	}

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