Devise\Models\Scaffolding\TemplateScaffolding::convertIndexes PHP Method

convertIndexes() protected method

protected convertIndexes ( $template, $fields ) : mixed
$template
$fields
return mixed
    protected function convertIndexes($template, $fields)
    {
        if (str_contains($template, '*|indexHeaders|*') || str_contains($template, '*|indexFields|*')) {
            $replacementHeaders = '';
            $replacementFields = '';
            $tab = '    ';
            foreach ($fields as $field) {
                if (isset($field['displayIndex']) && $field['displayIndex'] === true) {
                    $replacementHeaders .= $tab . '<th><?= Sort::link(\'' . $field['name'] . '\') ?></th>' . PHP_EOL;
                    $replacementFields .= $tab . $tab . "<td><?= \$" . $this->constants['singularVar'] . "['" . $field['name'] . "'] ?></td>" . PHP_EOL;
                }
            }
            $template = str_replace('*|indexHeaders|*', $replacementHeaders, $template);
            $template = str_replace('*|indexFields|*', $replacementFields, $template);
        }
        return $template;
    }