Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks
Marketing{} │ WC 1.0└─ Task
Marketing Task
Хуков нет.
Использование
$Marketing = new Marketing();
// use class methods
Методы
- public __construct( $task_list )
- public get_image_alt()
- public can_view()
- public get_content()
- public get_id()
- public get_image_url()
- public is_complete()
- public static get_plugins()
- public __( '2 minutes', 'woocommerce' )
- public get_time()
- public get_title()
- public static has_installed_extensions()
- public is_dismissable()
- public on_activated_plugin( $plugin )
- ERROR: no method name found on line `*/`
- ERROR: no method name found on line ``
- ERROR: no method name found on line `__METHOD__,`
- ERROR: no method name found on line ``
- ERROR: no method name found on line `*/`
- ERROR: no method name found on line `}`
- ERROR: no method name found on line `* Time.`
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
Код Marketing{} Marketing{}
WC 11.3.0
class Marketing extends Task {
/**
* Constructor
*
* @param TaskList $task_list Parent task list.
*/
public function __construct( $task_list ) {
parent::__construct( $task_list );
add_action( 'activated_plugin', array( $this, 'on_activated_plugin' ), 10, 1 );
}
/**
* Mark the task as complete when related plugins are activated.
*/
public function on_activated_plugin( $plugin ) {
$plugin_basename = basename( plugin_basename( $plugin ), '.php' );
// Example: How to mark the marketing task as complete when a specific plugin is activated.
/**
* Example:
* if (
* $plugin_basename === 'multichannel-by-cedcommerce' &&
* $this->task_list->visible &&
* ! $this->task_list->is_hidden() &&
* ! $this->is_complete()
* ) {
* $this->mark_actioned();
* }
*/
}
/**
* Used to cache is_complete() method result.
*
* @var null
*/
private $is_complete_result = null;
/**
* ID.
*
* @return string
*/
public function get_id() {
return 'marketing';
}
/**
* Contextual image URL.
*
* @return string
*/
public function get_image_url() {
return WC()->plugin_url() . '/assets/images/task_list/sales-illustration.svg';
}
/**
* Alt text for the contextual image.
*
* @return string
*/
public function get_image_alt() {
return __( 'Marketing illustration', 'woocommerce' );
}
/**
* Title.
*
* @return string
*/
public function get_title() {
return __( 'Grow your business', 'woocommerce' );
}
/**
* Content.
*
* @return string
*/
public function get_content() {
return __(
'Add recommended marketing tools to reach new customers and grow your business',
'woocommerce'
);
}
/**
* Time.
*
* @return string
*/
public function get_time() {
return __( '2 minutes', 'woocommerce' );
}
/**
* Task visibility.
*
* @return bool
*/
public function can_view() {
return true;
}
/**
* Check if a task is dismissable.
*
* @return bool
*/
public function is_dismissable() {
return true;
}
/**
* Get the marketing plugins.
*
* @deprecated 9.3.0 Removed to improve performance.
* @return array
*/
public static function get_plugins() {
wc_deprecated_function(
__METHOD__,
'9.3.0'
);
return array();
}
/**
* Check if the store has installed marketing extensions.
*
* @deprecated 9.3.0 Removed to improve performance.
* @return bool
*/
public static function has_installed_extensions() {
wc_deprecated_function(
__METHOD__,
'9.3.0'
);
return false;
}
}