Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Main::get_available_addons( string $status, bool $check_license, string $type = 'all' )
Retrieve an array of available add-on slugs based on the supplied query criteria.
Description Description
This function passes data to wp llms addon list
with specific filters and returns an associative array of add-on slugs from that list.
This is used, mostly, to generate a list of available addons for various commands which provide an --all
flag/option.
Parameters Parameters
- $status
-
(string) (Required) Add-on status, passed as the
--status
option tollms addon list
. - $check_license
-
(bool) (Required) Whether or not the add-on should be licensed. This is used to determine what is installable / upgradeable.
- $type
-
(string) (Optional) Add-on type. Accepts 'all' (default), 'plugin' or 'theme'.
Default value: 'all'
Return Return
(string[]) Array of add-on slugs meeting the specified filters.
Source Source
File: libraries/lifterlms-cli/src/Commands/AddOn/Main.php
private function get_available_addons( $status, $check_license, $type = 'all' ) { $list = \WP_CLI::runcommand( "llms addon list --format=json --status={$status} --fields=name,license,type", array( 'return' => true, ) ); $list = array_filter( json_decode( $list, true ), function( $item ) use ( $check_license, $type ) { return ( ( $check_license && 'active' === $item['license'] ) || ! $check_license ) && ( 'all' === $type || $type === $item['type'] ); } ); return wp_list_pluck( $list, 'name' ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
0.0.1 | Introduced. |