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

Public Member Functions

 __construct (State $appState)
 
 setHtml ($html)
 
 setCss ($css)
 
 disableStyleBlocksParsing ()
 
 process ()
 

Detailed Description

This class will inline the css of an html to each tag to be used for applications such as a styled email.

Definition at line 14 of file CssInliner.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( State  $appState)
Parameters
State$appState

Definition at line 24 of file CssInliner.php.

25  {
26  $this->emogrifier = new Emogrifier();
27  $this->emogrifier->setDebug($appState->getMode() === State::MODE_DEVELOPER);
28  }

Member Function Documentation

◆ disableStyleBlocksParsing()

disableStyleBlocksParsing ( )

Disables the parsing of <style> blocks.

Returns
void

Definition at line 57 of file CssInliner.php.

58  {
59  $this->emogrifier->disableStyleBlocksParsing();
60  }

◆ process()

process ( )

Processes the html by placing the css inline. Set first the css by using setCss and html by using setHtml.

Returns
string
Exceptions

Definition at line 68 of file CssInliner.php.

69  {
70  return $this->emogrifier->emogrify();
71  }

◆ setCss()

setCss (   $css)

Sets the CSS to be merged with the HTML. This method should be used with setHtml.

Parameters
string$css
Returns
void

Definition at line 47 of file CssInliner.php.

48  {
49  $this->emogrifier->setCss($css);
50  }

◆ setHtml()

setHtml (   $html)

Sets the HTML to be used with the css. This method should be used with setCss.

Parameters
string$html
Returns
void

Definition at line 36 of file CssInliner.php.

37  {
38  $this->emogrifier->setHtml($html);
39  }

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