|
|
|
|
@ -194,11 +194,13 @@ class MetadataProfileController extends ControllerBase {
|
|
|
|
|
$container->get('entity_type.manager'), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Builds a reverse map of field name → indexed field entries across all |
|
|
|
|
* Search API indexes. |
|
|
|
|
* |
|
|
|
|
* Map structure: |
|
|
|
|
* |
|
|
|
|
* @code |
|
|
|
|
* [ |
|
|
|
|
* 'field_abstract' => [ |
|
|
|
|
@ -329,7 +331,8 @@ class MetadataProfileController extends ControllerBase {
|
|
|
|
|
* The bundle configuration object. |
|
|
|
|
* |
|
|
|
|
* @return array |
|
|
|
|
* A render array containing the bundle label, machine name, and description. |
|
|
|
|
* A render array containing the bundle label, machine name, and |
|
|
|
|
* description. |
|
|
|
|
*/ |
|
|
|
|
protected function formatBundle(Config $bundle) { |
|
|
|
|
if (str_starts_with($bundle->getName(), 'node.type')) { |
|
|
|
|
@ -1397,7 +1400,7 @@ class MetadataProfileController extends ControllerBase {
|
|
|
|
|
if (is_array($element)) { |
|
|
|
|
if (isset($element['data']) && array_key_exists('#markup', $element['data'])) { |
|
|
|
|
preg_match('/title=["\']([^"\']*)["\']/', $element['data']['#markup'], $matches); |
|
|
|
|
$rows[$row_key][$element_key] = $matches[1] ?? null; |
|
|
|
|
$rows[$row_key][$element_key] = $matches[1] ?? NULL; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$rows[$row_key][$element_key] = implode('|', $element); |
|
|
|
|
@ -1420,14 +1423,14 @@ class MetadataProfileController extends ControllerBase {
|
|
|
|
|
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse |
|
|
|
|
* The file download response. |
|
|
|
|
*/ |
|
|
|
|
public function download(NodeTypeInterface $node_type) { |
|
|
|
|
public function download(?NodeTypeInterface $node_type = NULL) { |
|
|
|
|
// Rebuild your state from the entity |
|
|
|
|
if ($node_type) { |
|
|
|
|
$this->entityBundle = $node_type->id(); |
|
|
|
|
$this->entityTypeBundleOf = $node_type->getEntityType()->getBundleOf(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$contentType = $this->entityBundle; |
|
|
|
|
$entityKey = $this->entityTypeBundleOf; |
|
|
|
|
|
|
|
|
|
$headers = array_map(function($header) { |
|
|
|
|
return is_array($header) && isset($header['data']) ? (string) $header['data'] : (string) $header; |
|
|
|
|
}, $this->getHeaders()); |
|
|
|
|
@ -1435,7 +1438,7 @@ class MetadataProfileController extends ControllerBase {
|
|
|
|
|
$rows = $this->getRows($metadata_profile); |
|
|
|
|
$rows = $this->sanitizeRowsForCSV($rows); |
|
|
|
|
|
|
|
|
|
$filename_slug = "{$entityKey}__{$contentType}.csv"; |
|
|
|
|
$filename_slug = "{$entityKey}__{$this->entityBundle}.csv"; |
|
|
|
|
$filename = $this->fileSystem->getTempDirectory() . '/' . $filename_slug; |
|
|
|
|
|
|
|
|
|
if (file_exists($filename)) { |
|
|
|
|
@ -1613,7 +1616,6 @@ class MetadataProfileController extends ControllerBase {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foreach ($field_definitions as $field_name => $field_definition) { |
|
|
|
|
|
|
|
|
|
// Only configurable fields (skip base fields like title) |
|
|
|
|
if ($field_definition->getFieldStorageDefinition() instanceof \Drupal\Core\Field\BaseFieldDefinition) { |
|
|
|
|
continue; |
|
|
|
|
|