| @@ -3,8 +3,9 @@ | ||
| 3 | 3 | |
| 4 | 4 | |
| 5 | 5 | use Averta\Core\Hydrate\HydratableInterface; |
| 6 | 6 | use Averta\Core\Utility\Arr; |
| 7 | +use Averta\Core\Utility\Data; | |
| 7 | 8 | use Averta\WordPress\Utility\Sanitize; |
| 8 | 9 | use Depicter\Document\CSS\Selector; |
| 9 | 10 | use Depicter\Document\Models\Options\Loading; |
| 10 | 11 | use Depicter\Document\Models\Options\Script; |
| @@ -52,8 +53,13 @@ | ||
| 52 | 53 | */ |
| 53 | 54 | public $meta; |
| 54 | 55 | |
| 55 | 56 | /** |
| 57 | + * @var array | |
| 58 | + */ | |
| 59 | + public $env = []; | |
| 60 | + | |
| 61 | + /** | |
| 56 | 62 | * Start from which section |
| 57 | 63 | * |
| 58 | 64 | * @var int |
| 59 | 65 | */ |
| @@ -101,8 +107,15 @@ | ||
| 101 | 107 | */ |
| 102 | 108 | private $args = []; |
| 103 | 109 | |
| 104 | 110 | /** |
| 111 | + * Check if document is ai generated or not | |
| 112 | + * | |
| 113 | + * @var boolean | |
| 114 | + */ | |
| 115 | + public $isBuildWithAI = false; | |
| 116 | + | |
| 117 | + /** | |
| 105 | 118 | * Extract values for this class |
| 106 | 119 | * |
| 107 | 120 | * @return array |
| 108 | 121 | */ |
| @@ -243,15 +256,25 @@ | ||
| 243 | 256 | |
| 244 | 257 | /** |
| 245 | 258 | * Collects fonts and generates a link for loading document fonts |
| 246 | 259 | */ |
| 247 | - protected function collectAndSetFontsData() | |
| 248 | - { | |
| 260 | + protected function collectAndSetFontsData(){ | |
| 261 | + if( !empty( $this->env['additionalFonts'] ) ){ | |
| 262 | + // convert to array recursively | |
| 263 | + $this->env['additionalFonts'] = Data::cast( $this->env['additionalFonts'], 'array' ); | |
| 264 | + | |
| 265 | + if( is_array( $this->env['additionalFonts'] ) ){ | |
| 266 | + foreach( $this->env['additionalFonts'] as $localFontName => $localFontInfo ){ | |
| 267 | + \Depicter::documentFonts()->addLocalFont( $this->getDocumentID(), $localFontName, $localFontInfo['variants'] ); | |
| 268 | + } | |
| 269 | + } | |
| 270 | + } | |
| 271 | + | |
| 249 | 272 | foreach ( $this->sections as $section ) { |
| 250 | 273 | // this method adds element fonts to documentFonts service |
| 251 | 274 | $section->collectElementFonts(); |
| 252 | 275 | } |
| 253 | - $this->fontLink = \Depicter::app()->documentFonts()->getFontsLink( $this->getDocumentID() ); | |
| 276 | + $this->fontLink = \Depicter::documentFonts()->getFontsLink( $this->getDocumentID() ); | |
| 254 | 277 | } |
| 255 | 278 | |
| 256 | 279 | /** |
| 257 | 280 | * Render document custom styles |