ACF_Updates::modify_plugin_details() public ACF 5.0.0
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(строка)
- -
- $args(объект)
- -
Список изменений
С версии 5.0.0 | Введена. |
Код ACF_Updates::modify_plugin_details() ACF Updates::modify plugin details ACF 5.9.1
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;
}