Inventory_Presser_Admin_Photo_Arranger::maintain_gallery_during_attach_and_detach( mixed $action, mixed $attachment_id, mixed $parent_id )

maintain_gallery_during_attach_and_detach


Parameters Parameters

$action

(mixed) (Required)

$attachment_id

(mixed) (Required)

$parent_id

(mixed) (Required)


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/admin/class-admin-photo-arranger.php

	public function maintain_gallery_during_attach_and_detach( $action, $attachment_id, $parent_id ) {
		$parent_id = intval( $parent_id );
		if ( 'detach' === $action ) {
			$this->remove_attachment_from_gallery( $attachment_id, $parent_id );
			// Remove vehicle-specific meta values.
			delete_post_meta( $attachment_id, apply_filters( 'invp_prefix_meta_key', 'photo_number' ) );
			delete_post_meta( $attachment_id, apply_filters( 'invp_prefix_meta_key', 'vin' ) );
			Inventory_Presser_Photo_Numberer::renumber_photos( $parent_id );
			return;
		}
		$this->add_attachment_to_gallery( $attachment_id, $parent_id );
	}