Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
Conditions Class Reference

Public Member Functions

 __construct (Json $serializer=null, Normalizer $normalizer=null)
 
 encode (array $value)
 
 decode ($value)
 

Detailed Description

Widget Conditions helper.

Definition at line 15 of file Conditions.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Json  $serializer = null,
Normalizer  $normalizer = null 
)
Parameters
Json$serializer
Normalizer$normalizer

Definition at line 31 of file Conditions.php.

34  {
35  $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
36  $this->normalizer = $normalizer ?: ObjectManager::getInstance()->get(Normalizer::class);
37  }

Member Function Documentation

◆ decode()

decode (   $value)

Decode previously encoded widget conditions.

Parameters
string$value
Returns
array

Definition at line 56 of file Conditions.php.

57  {
58  return $this->serializer->unserialize(
59  $this->normalizer->restoreReservedCharacters($value)
60  );
61  }
$value
Definition: gender.phtml:16

◆ encode()

encode ( array  $value)

Encode widget conditions to be used with WYSIWIG.

Parameters
array$value
Returns
string

Definition at line 45 of file Conditions.php.

46  {
47  return $this->normalizer->replaceReservedCharacters($this->serializer->serialize($value));
48  }
$value
Definition: gender.phtml:16

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