LLMS_REST_Webhooks::update_prepare( array $data )

Prepare data for an update.


Parameters Parameters

$data

(array) (Required) Associative array of data to set to a resources properties.


Top ↑

Return Return

(LLMS_REST_Webhook|WP_Error)


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/class-llms-rest-webhooks.php

	 * @since 1.0.0-beta.1
	 * @since 1.0.0-beta.17 Remove reference to 'pending_delivery' (unused) column.
	 *
	 * @param array $data Associative array of data to set to a resources properties.
	 * @return LLMS_REST_Webhook|WP_Error
	 */
	protected function update_prepare( $data ) {

		$url = isset( $data['delivery_url'] );

		// Merge in (some) default values.
		$defaults = $this->get_default_column_values();
		unset( $defaults['failure_count'] );
		$data = wp_parse_args( array_filter( $data ), $defaults );

		// URL was supplied but empty so add it back in to get caught by validation.
		if ( $url && ! isset( $data['delivery_url'] ) ) {
			$data['delivery_url'] = '';
		}

		// Validate via default parent methods.
		$data = parent::update_prepare( $data );

		if ( is_wp_error( $data ) ) {
			return $data;
		}



Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.17 Remove reference to 'pending_delivery' (unused) column.
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.