Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ColumnProvider.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
12 use \Magento\Framework\Exception\LocalizedException;
13 
18 {
23  {
24  $columns = [];
25  foreach ($attributeCollection->getItems() as $item) {
26  $columns[] = $item->getData('id');
27  }
28 
30  return $columns;
31  }
32 
33  if (count($filters[Export::FILTER_ELEMENT_SKIP]) === count($columns)) {
34  throw new LocalizedException(__('There is no data for the export.'));
35  }
36 
37  // remove the skipped from columns
38  $skippedAttributes = array_flip($filters[Export::FILTER_ELEMENT_SKIP]);
39  foreach ($columns as $key => $value) {
40  if (array_key_exists($value, $skippedAttributes) === true) {
41  unset($columns[$key]);
42  }
43  }
44 
45  return $columns;
46  }
47 
52  {
53  return $this->getHeaders($attributeCollection, $filters);
54  }
55 }
getHeaders(AttributeCollection $attributeCollection, array $filters)
__()
Definition: __.php:13
$columns
Definition: default.phtml:15
$value
Definition: gender.phtml:16
getColumns(AttributeCollection $attributeCollection, array $filters)
$filters
Definition: uploader.phtml:11