protected function generateModules(array $config, array $modules, ?GridIterator $iterator = null): array
    {
        $buffer = [];

        foreach ($config as $entry) {
            if ($entry['inactive'] || !$entry['module']) {
                continue;
            }

            if (is_numeric($entry['module'])) {
                if (!empty($modules[$entry['module']])) {
                    $buffer[] = $modules[$entry['module']];
                }

                continue;
            }

            if ($iterator) {
                $iterator->next();

                foreach ($iterator->resets() as $reset) {
                    $buffer[] = '<div class="clearfix w-100 ' . $reset . '"></div>';
                }

                $buffer[] = sprintf(
                    "\n" . '</div>' . "\n" . '<div class="%s">',
                    $iterator->current()
                );
            }
        }

        return $buffer;
    }