Skip to content

Commit

Permalink
Check if element index sources exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Olde Hampsink committed Apr 19, 2017
1 parent 282d69a commit b651771
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Services/ElementIndexSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,18 @@ public function export(array $data = [])
private function getMappedSettings(array $settings, $fromIndex, $toIndex)
{
$mappedSettings = ['sources' => []];
foreach ($settings['sources'] as $source => $sourceSettings) {
$mappedSource = Craft::app()->schematic_sources->getSource(false, $source, $fromIndex, $toIndex);
$tableAttributesSettings = [];
foreach ($sourceSettings['tableAttributes'] as $index => $columnSource) {
$mappedColumnSource = Craft::app()->schematic_sources->getSource(false, $columnSource, $fromIndex, $toIndex);
$tableAttributesSettings[$index] = $mappedColumnSource;
if (isset($settings['sources'])) {
foreach ($settings['sources'] as $source => $sourceSettings) {
$mappedSource = Craft::app()->schematic_sources->getSource(false, $source, $fromIndex, $toIndex);
$tableAttributesSettings = [];
foreach ($sourceSettings['tableAttributes'] as $index => $columnSource) {
$mappedColumnSource = Craft::app()->schematic_sources->getSource(false, $columnSource, $fromIndex, $toIndex);
$tableAttributesSettings[$index] = $mappedColumnSource;
}
$mappedSettings['sources'][$mappedSource] = ['tableAttributes' => $tableAttributesSettings];
}
$mappedSettings['sources'][$mappedSource] = ['tableAttributes' => $tableAttributesSettings];
}

return $mappedSettings;
}
}

0 comments on commit b651771

Please sign in to comment.