Bolt\Legacy\Storage::getRepeaters PHP Method

getRepeaters() public method

public getRepeaters ( $content )
    public function getRepeaters($content)
    {
        $ids = array_column($content, 'id');
        if (empty($ids)) {
            return;
        }
        // Get the contenttype from first $content
        $first = reset($content);
        $contenttypeslug = $first->contenttype['slug'];
        $contenttype = $this->getContentType($contenttypeslug);
        $repo = $this->app['storage']->getRepository('Bolt\\Storage\\Entity\\FieldValue');
        foreach ($ids as $id) {
            foreach ($contenttype['fields'] as $fieldkey => $field) {
                if ($field['type'] == 'repeater') {
                    $collection = new RepeatingFieldCollection($this->app['storage'], $field);
                    try {
                        $existingFields = $repo->getExistingFields($id, $contenttypeslug, $fieldkey) ?: [];
                        foreach ($existingFields as $group => $ids) {
                            $collection->addFromReferences($ids, $group);
                        }
                    } catch (Exception $e) {
                    }
                    $content[$id]->setValue($fieldkey, $collection);
                }
            }
        }
    }