Load module logic.

@param Product $product Product to load the module for.

@return Licenser Module object.
333695
public function load( $product ) {
		$this->product = $product;

		$this->product_key = $this->product->get_key() . '-update-response';

		$this->license_key = $this->product->get_license();
		if ( $this->product->requires_license() ) {
			$this->failed_checks = intval( get_option( $this->product->get_key() . '_failed_checks', 0 ) );
			$this->register_license_hooks();
		}

		if ( $this->product->is_plugin() ) {
			add_filter(
				'pre_set_site_transient_update_plugins',
				[
					$this,
					'pre_set_site_transient_update_plugins_filter',
				]
			);
			add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
			add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );

			return $this;
		}
		if ( $this->product->is_theme() ) {
			add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
			add_filter( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
			add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
			add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
			add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
			add_filter( 'http_request_args', array( $this, 'disable_wporg_update' ), 5, 2 );

			return $this;

		}

		return $this;
	}
569894
public function load( $product ) {
		$this->product = $product;

		$notifications       = apply_filters( 'themeisle_sdk_registered_notifications', [] );
		$notifications       = array_filter(
			$notifications,
			function ( $value ) {
				if ( ! isset( $value['id'] ) ) {
					return false;
				}
				if ( get_option( $value['id'], '' ) !== '' ) {
					return false;
				}

				return apply_filters( $value['id'] . '_should_show', true );
			}
		);
		self::$notifications = $notifications;
		add_action( 'admin_notices', array( __CLASS__, 'show_notification' ) );
		add_action( 'wp_ajax_themeisle_sdk_dismiss_notice', array( __CLASS__, 'dismiss' ) );
		add_action( 'admin_head', array( __CLASS__, 'setup_notifications' ) );

		return $this;
	}
465988
public function addProduct(Product $product)
    {
        if (count($this->products) > self::MAX_PRODUCT_COUNT) {
            throw new TooManyProducts(
                sprintf(
                    'Paytrail can only handle up to %d different products. Please group products using "amount".',
                    self::MAX_PRODUCT_COUNT
                )
            );
        }
        $this->products[] = $product;
    }
1210480
public function loadModuleDependencies($module)
    {
        $config = $module->getConfig();
        if (isset($config['modules'])) {
            $this->loadConfig($config, $module);
        }
    }
748501
public function getProductOrderBook(RequestProduct $product) {
        return $this->get(['products', $product->getProductId(), 'book'], ResponseProductOrderBook::class, $product->toArray());
    }
1140434
public function getLineItemForProduct(Product $product)
    {
        foreach ($this->getLineItems() as $lineItem)
        {
            if ($lineItem->getProduct()->getId() == $product->getId())
            {
                return $lineItem;
            }
        }

        return $this->createLineItemForProduct($product);
    }
25284
public function preLoadEntityId(array $product)
    {
        $this->preLoadedEntityIds[$product[MemberNames::SKU]] = $product[MemberNames::ENTITY_ID];
    }
659826
protected function prepareProduct(array &$product)
    {
        $options = array(
            'store_id' => $product['store_id'],
            'product_id' => $product['product_id']
        );

        $product['related'] = $this->product->getRelated($options);
        $product['price'] = $this->price->decimal($product['price'], $product['currency']);

        $this->setSkuCombinationProduct($product);
        $this->setItemAlias($product, 'product', $this->alias);
        $this->setItemImages($product, 'product', $this->image);
        $this->setItemTranslation($product, 'product', $this->translation_entity);

        if (!empty($product['images'])) {
            foreach ($product['images'] as &$file) {
                $this->setItemTranslation($file, 'file', $this->translation_entity);
            }
        }
    }
700591
public function setProduct(\Amulen\ShopBundle\Entity\Product $product = null)
    {
        $this->product = $product;

        return $this;
    }
250699
public function setProduct(\Magento\Catalog\Model\Product $product)
    {
        $this->setProductName($product->getName());
        $this->setProductSku($product->getSku());

        return $this;
    }
517432
public function getCheapestEnabledVariation(ProductInterface $product)
    {
        if (!$this->productPool->getProvider($product)->hasVariations($product)) {
            return $product;
        }

        return $this->productPool->getProvider($product)->getCheapestEnabledVariation($product);
    }
835469
private function get_product_info( Yoast_Product $product ) {
		if ( ! class_exists( 'Yoast_Plugin_License_Manager' ) ) {
			return 'License manager could not be loaded';
		}

		$license_manager = new Yoast_Plugin_License_Manager( $product );

		$out = '<table>';
		$out .= '<tr><td>Version</td><td>' . WPSEO_VERSION . '</td></tr>';
		$out .= '<tr><td>License</td><td>' . '<a href=" ' . admin_url( 'admin.php?page=wpseo_licenses#top#licenses' ) . ' ">' . $license_manager->get_license_key() . '</a>' . '</td></tr>';
		$out .= '<tr><td>Status</td><td>' . $license_manager->get_license_status() . '</td></tr>';
		$out .= '</table>';

		return $out;
	}
864947
protected function prepareProduct(array &$product)
    {
        $selected = $this->getSelectedCombinationProduct($product);
        $this->unshiftSelectedImageProduct($selected, $product);

        $this->setItemImages($product, 'product', $this->image);
        $this->setItemThumbProduct($product, $this->image);
        $this->setItemProductInComparison($product, $this->product_compare);
        $this->setItemProductBundle($product, $this->product, $this->image);
        $this->setItemProductInWishlist($product, $this->wishlist);

        $this->setItemPriceCalculated($selected, $this->product);
        $this->setItemPriceFormatted($selected, $this->price, $this->current_currency);

        $product['selected_combination'] = $selected;
        $product['total_reviews'] = $this->getTotalReviewsProduct($product);

        $this->setItemProductFields($product, $this->image, $this->product_class);
    }
546987
public function destroy(Product $product)
    {
        $this->product->destroy($product);

        return redirect()->route('admin.product.product.index')
            ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('product::products.title.products')]));
    }
834791
private function getProductOptionsAsArray(ProductInterface $product): array
    {
        $optionsAsArray = [];

        foreach ($product->getOptionTypes() as $label) {
            foreach ($label->getOptions() as $option) {
                $optionsAsArray[$label->getName()][] = $option;
            }
        }

        return $optionsAsArray;
    }
1110025
public function addProduct(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Product\Product $product)
    {
        $this->products[] = $product;

        return $this;
    }
674331
public function setStatusForProduct(ProductInterface $product, $statusId)
    {
        // Check if status has changed.
        if ($product->getStatus() && $product->getStatus()->getId() === $statusId) {
            return;
        }

        $status = $this->statusRepository->find($statusId);
        if (!$status) {
            throw new ProductDependencyNotFoundException(self::$productStatusEntityName, $statusId);
        }

        // Set new status to product.
        $product->setStatus($status);

        // If product has variants, set status for all variants as well.
        if ($product->getType()
            && $product->getType()->getId() === (int) $this->productTypesMap['PRODUCT_WITH_VARIANTS']
        ) {
            $variants = $this->productRepository->findByParent($product);
            foreach ($variants as $variant) {
                $variant->setStatus($status);
            }
        }
    }