function ContentExport::load_entity_config_list_with_path in Content Export YAML 8
Get one Entity exported
Parameters
$entity String node eg : /taxonomy_term /...:
File
- src/
ContentExport.php, line 73
Class
- ContentExport
- Created by PhpStorm. User: USER Date: 11/13/18 Time: 2:04 PM
Namespace
Drupal\content_export_yamlCode
function load_entity_config_list_with_path($entity, $bundle, $ranges_nid = [], $path = NULL) {
$items = [];
if ($path) {
$themes_str = $path;
}
else {
$config = \Drupal::config('content_export_yaml.contentexportsetting');
$themes_str = $config
->get('path_export_content_folder');
}
if ($themes_str) {
if (empty($ranges_nid)) {
if ($bundle) {
$items = $this
->readDirectory($themes_str . "/" . $entity . "/" . $bundle);
}
else {
$items = $this
->readDirectory($themes_str . "/" . $entity);
}
foreach ($items as $key => $file) {
if (file_exists($file)) {
$items[$key] = file_get_contents($file, FILE_USE_INCLUDE_PATH);
}
else {
$this->logger
->error('File not find exist : ' . $file);
}
}
}
else {
for ($i = $ranges_nid[0]; $i < $ranges_nid[0] + 1; $i++) {
if ($bundle) {
$file = DRUPAL_ROOT . '/' . $themes_str . "/" . $entity . "/" . $bundle . "/" . $i . ".yml";
}
else {
$file = DRUPAL_ROOT . '/' . $themes_str . "/" . $entity . "/" . $i . ".yml";
}
if (file_exists($file)) {
$items[$i] = file_get_contents($file, FILE_USE_INCLUDE_PATH);
}
else {
$this->logger
->error('File not find exist : ' . $file);
}
}
}
}
else {
$this->logger
->error('Path directory empty ');
}
return $items;
}