Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Static Public Member Functions | Static Protected Attributes
Factory Class Reference

Static Public Member Functions

static getHelper ($name)
 
static setHelper ($name, $helper)
 

Static Protected Attributes

static $_instances = []
 

Detailed Description

Definition at line 12 of file Factory.php.

Member Function Documentation

◆ getHelper()

static getHelper (   $name)
static

Retrieves singleton instance of helper

Parameters
string$name
Returns
mixed

Definition at line 25 of file Factory.php.

26  {
27  if (!isset(self::$_instances[$name])) {
28  $className = preg_replace('/[^_]*$/', ucfirst($name), __CLASS__, 1);
29  self::$_instances[$name] = new $className();
30  }
31  return self::$_instances[$name];
32  }
if($currentSelectedMethod==$_code) $className
Definition: form.phtml:31
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ setHelper()

static setHelper (   $name,
  $helper 
)
static

Sets custom helper instance to be used for specific name, or null to clear instance. Returns previous instance (if any) or null (if no helper was defined).

Parameters
string$name
mixed$helper
Returns
mixed

Definition at line 42 of file Factory.php.

43  {
44  $old = isset(self::$_instances[$name]) ? self::$_instances[$name] : null;
45  self::$_instances[$name] = $helper;
46  return $old;
47  }
$old
Definition: website.php:27
$helper
Definition: iframe.phtml:13
if(!isset($_GET['name'])) $name
Definition: log.php:14

Field Documentation

◆ $_instances

$_instances = []
staticprotected

Definition at line 17 of file Factory.php.


The documentation for this class was generated from the following file: