Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Attributes
HtmlContent Class Reference
Inheritance diagram for HtmlContent:
AbstractComponent BlockWrapperInterface DataObject UiComponentInterface UiComponentInterface BlockInterface BlockInterface

Public Member Functions

 __construct (ContextInterface $context, BlockInterface $block, array $components=[], array $data=[])
 
 getBlock ()
 
 getComponentName ()
 
 render ()
 
 getConfiguration ()
 
- Public Member Functions inherited from AbstractComponent
 __construct (ContextInterface $context, array $components=[], array $data=[])
 
 getContext ()
 
 getName ()
 
 prepare ()
 
 toHtml ()
 
 render ()
 
 addComponent ($name, UiComponentInterface $component)
 
 getComponent ($name)
 
 getChildComponents ()
 
 renderChildComponent ($name)
 
 getTemplate ()
 
 getConfiguration ()
 
 getJsConfig (UiComponentInterface $component)
 
 setData ($key, $value=null)
 
 getData ($key='', $index=null)
 
 prepareDataSource (array $dataSource)
 
 getDataSourceData ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 

Data Fields

const NAME = 'html_content'
 

Protected Attributes

 $block
 
- Protected Attributes inherited from AbstractComponent
 $context
 
 $components
 
 $componentData = []
 
 $dataSources = []
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractComponent
 prepareChildComponent (UiComponentInterface $component)
 
 initObservers (array & $data=[])
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

Definition at line 12 of file HtmlContent.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ContextInterface  $context,
BlockInterface  $block,
array  $components = [],
array  $data = [] 
)
Parameters
ContextInterface$context
BlockInterface$block
array$components
array$data

Definition at line 27 of file HtmlContent.php.

Member Function Documentation

◆ getBlock()

getBlock ( )

Get wrapped block

Returns
BlockInterface

Implements BlockWrapperInterface.

Definition at line 42 of file HtmlContent.php.

43  {
44  return $this->block;
45  }

◆ getComponentName()

getComponentName ( )

Get component name

Returns
string

Implements UiComponentInterface.

Definition at line 52 of file HtmlContent.php.

53  {
54  return static::NAME;
55  }

◆ getConfiguration()

getConfiguration ( )

@inheritDoc

Implements UiComponentInterface.

Definition at line 68 of file HtmlContent.php.

69  {
70  $configuration = parent::getConfiguration();
71  if ($this->getData('wrapper/canShow') !== false) {
72  if ($this->getData('isAjaxLoaded')) {
73  $configuration['url'] = $this->getData('url');
74  } else {
75  if (!$this->getData('config/content')) { //add html block cony into cache
76  $content = $this->block->toHtml();
77  $this->addData(['config' => ['content' => $content]]);
78  }
79 
80  $configuration['content'] = $this->getData('config/content');
81  }
82  if ($this->getData('wrapper')) {
83  $configuration = array_merge($this->getData(), $this->getData('wrapper'));
84  }
85  }
86  return $configuration;
87  }
$configuration
Definition: index.php:33

◆ render()

render ( )

@inheritDoc

Implements UiComponentInterface.

Definition at line 60 of file HtmlContent.php.

61  {
62  return $this->getData('config/content') ?: $this->block->toHtml();
63  }

Field Documentation

◆ $block

$block
protected

Definition at line 19 of file HtmlContent.php.

◆ NAME

const NAME = 'html_content'

Definition at line 14 of file HtmlContent.php.


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