public function ManageExport::exportFrom in Content Export YAML 8
4 calls to ManageExport::exportFrom()
File
- src/
ManageExport.php, line 37
Class
Namespace
Drupal\content_export_yamlCode
public function exportFrom($entity, $bundle, $options = []) {
$rangenid = [];
if (isset($options['range']) && isset($options['range'][0]) && isset($options['range'][1])) {
$rangenid[0] = $options['range'][0];
$rangenid[1] = $options['range'][1];
}
$object_list = $this->func
->load_entity_list($entity, $bundle, $rangenid);
$id_label = \Drupal::entityTypeManager()
->getDefinition($entity)
->getKey('id');
$status_list = [];
foreach ($object_list as $id) {
$object = \Drupal::entityTypeManager()
->getStorage($entity)
->load($id);
if (is_object($object)) {
$status = $this->func
->exportWithPath($object, $entity, $options);
$status_list[] = [
'status' => $status,
'label' => $object
->label(),
$id_label => $object
->id(),
];
}
}
return $status_list;
}