public static function ConfigBit::getConfigBit in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.6
Same name and namespace in other branches
- 8.8 src/Config/ConfigBit.php \Drupal\varbase\Config\ConfigBit::getConfigBit()
- 8.4 src/Config/ConfigBit.php \Drupal\varbase\config\ConfigBit::getConfigBit()
- 8.5 src/Config/ConfigBit.php \Drupal\varbase\config\ConfigBit::getConfigBit()
- 8.7 src/Config/ConfigBit.php \Drupal\varbase\config\ConfigBit::getConfigBit()
- 9.0.x src/Config/ConfigBit.php \Drupal\varbase\Config\ConfigBit::getConfigBit()
Get Config Bit file.
Load config bit file as an array, with full file name and path.
Parameters
string $config_bit_file_name: Config bit file name in the root configbit folder.
string $type: Config bit file source type (profile / module).
string $project: Config bit file source eg. varbase.
Return value
array|int array of config bit. FALSE if we do not have the config_bit in the config bit file.
5 calls to ConfigBit::getConfigBit()
- ConfigBit::actionAdd in src/
Config/ ConfigBit.php - Applay the action of adding config bit in to the parent file.
- ConfigBit::actionArchiveFiles in src/
Config/ ConfigBit.php - Applay the action of archive files to the given config bit file.
- ConfigBit::actionRemove in src/
Config/ ConfigBit.php - Applay the action of removing config bit from the parent file.
- ConfigBit::actionUnArchiveFiles in src/
Config/ ConfigBit.php - Applay the action of Un archive files to the given config bit file.
- ConfigBit::getList in src/
Config/ ConfigBit.php - Get a list of sub list of config.
File
- src/
Config/ ConfigBit.php, line 28
Class
- ConfigBit
- Defines config bit to help in managing custom config which used in install.
Namespace
Drupal\varbase\configCode
public static function getConfigBit($config_bit_file_name, $type = 'profile', $project = 'varbase') {
// Generate full path to config file.
$full_config_bit_file_name = drupal_get_path($type, $project) . '/' . $config_bit_file_name;
if (file_exists($full_config_bit_file_name)) {
// Pars the config bit file and have it as an array if it was not.
$config_bit_data = (array) Yaml::parse(file_get_contents($full_config_bit_file_name));
if (isset($config_bit_data['config_bit'])) {
return $config_bit_data['config_bit'];
}
else {
return FALSE;
}
}
else {
throw new \Exception('Config bit file does not exist!');
}
}