ACF_Updates::modify_plugin_details()publicACF 5.0.0

modify_plugin_details

Returns the plugin data visible in the 'View details' popup

Метод класса: ACF_Updates{}

Хуков нет.

Возвращает

$result.

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

$ACF_Updates = new ACF_Updates();
$ACF_Updates->modify_plugin_details( $result, $action, $args );
$result(объект) (обязательный)
-
$action(строка)
-
По умолчанию: null
$args(объект)
-
По умолчанию: null

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

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

Код ACF_Updates::modify_plugin_details() ACF 6.0.4

function modify_plugin_details( $result, $action = null, $args = null ) {

	// vars
	$plugin = false;

	// only for 'plugin_information' action
	if ( $action !== 'plugin_information' ) {
		return $result;
	}

	// find plugin via slug
	$plugin = $this->get_plugin_by( 'slug', $args->slug );
	if ( ! $plugin ) {
		return $result;
	}

	// connect
	$response = $this->get_plugin_info( $plugin['id'] );

	// bail early if no response
	if ( ! is_array( $response ) ) {
		return $result;
	}

	// remove tags (different context)
	unset( $response['tags'] );

	// convert to object
	$response = (object) $response;

	// sections
	$sections = array(
		'description'    => '',
		'installation'   => '',
		'changelog'      => '',
		'upgrade_notice' => '',
	);
	foreach ( $sections as $k => $v ) {
		$sections[ $k ] = $response->$k;
	}
	$response->sections = $sections;

	// return
	return $response;
}