Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
BundleConfig Class Reference

Public Member Functions

 __construct (View\ConfigInterface $viewConfig, ThemeProviderInterface $themeProvider)
 
 getBundleFileMaxSize ($area, $theme)
 
 getExcludedDirectories ($area, $theme)
 
 getExcludedFiles ($area, $theme)
 

Data Fields

const VIEW_CONFIG_MODULE = 'Js_Bundle'
 
const VIEW_CONFIG_BUNDLE_SIZE_NAME = 'bundle_size'
 

Detailed Description

Static files bundling configuration

Use this to get configuration settings related to JavaScript built-in bundling

Definition at line 16 of file BundleConfig.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( View\ConfigInterface  $viewConfig,
ThemeProviderInterface  $themeProvider 
)

BundleConfig constructor

Parameters
View\ConfigInterface$viewConfig
ThemeProviderInterface$themeProvider

Definition at line 57 of file BundleConfig.php.

60  {
61  $this->viewConfig = $viewConfig;
62  $this->themeProvider = $themeProvider;
63  }

Member Function Documentation

◆ getBundleFileMaxSize()

getBundleFileMaxSize (   $area,
  $theme 
)

Max size of bundle files (in KB)

Parameters
string$area
string$theme
Returns
int

Definition at line 72 of file BundleConfig.php.

73  {
74  $size = $this->getConfig($area, $theme)->getVarValue(
75  self::VIEW_CONFIG_MODULE,
76  self::VIEW_CONFIG_BUNDLE_SIZE_NAME
77  );
78  $unit = preg_replace('/[^a-zA-Z]+/', '', $size);
79  $unit = strtoupper($unit);
80  switch ($unit) {
81  case 'KB':
82  return (int)$size;
83  case 'MB':
84  return (int)$size * 1024;
85  default:
86  return (int)($size / 1024);
87  }
88  }
$theme

◆ getExcludedDirectories()

getExcludedDirectories (   $area,
  $theme 
)

Get list of directories which must be excluded

Parameters
string$area
string$theme
Returns
array

Definition at line 97 of file BundleConfig.php.

98  {
99  return $this->getConfig($area, $theme)->getExcludedDir();
100  }
$theme

◆ getExcludedFiles()

getExcludedFiles (   $area,
  $theme 
)

Get list of files which must be excluded from bundling

Parameters
string$area
string$theme
Returns
array

Definition at line 109 of file BundleConfig.php.

110  {
111  return $this->getConfig($area, $theme)->getExcludedFiles();
112  }
$theme

Field Documentation

◆ VIEW_CONFIG_BUNDLE_SIZE_NAME

const VIEW_CONFIG_BUNDLE_SIZE_NAME = 'bundle_size'

Name of the bundle file size configuration setting

Definition at line 26 of file BundleConfig.php.

◆ VIEW_CONFIG_MODULE

const VIEW_CONFIG_MODULE = 'Js_Bundle'

Namespace of the bundling configuration

Definition at line 21 of file BundleConfig.php.


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