Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

Marketing{} │ WC 1.0└─ Task

Marketing Task

Хуков нет.

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

$Marketing = new Marketing();
// use class methods

Методы

  1. public __construct( $task_list )
  2. public get_image_alt()
  3. public can_view()
  4. public get_content()
  5. public get_id()
  6. public get_image_url()
  7. public is_complete()
  8. public static get_plugins()
  9. public __( '2 minutes', 'woocommerce' )
  10. public get_time()
  11. public get_title()
  12. public static has_installed_extensions()
  13. public is_dismissable()
  14. public on_activated_plugin( $plugin )
  15. ERROR: no method name found on line `*/`
  16. ERROR: no method name found on line ``
  17. ERROR: no method name found on line `__METHOD__,`
  18. ERROR: no method name found on line ``
  19. ERROR: no method name found on line `*/`
  20. ERROR: no method name found on line `}`
  21. ERROR: no method name found on line `* Time.`
  22. ERROR: no method name found on line ``
  23. ERROR: no method name found on line ``

Код 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;
	}
}