src/Charcoal/Admin/Ui/NestedWidgetContainerTrait.php
protected function renderDataRecursive($data)
    {
        if (!is_array($data) && !($data instanceof Traversable)) {
            throw new InvalidArgumentException('The renderable data must be iterable.');
        }

        if (!$this->form() instanceof ObjectContainerInterface) {
            throw new RuntimeException(sprintf(
                'The [%s] widget has no data model.',
                static::CLASS
            ));
        }

        foreach ($data as $key => $val) {
            if (is_string($val)) {
                $data[$key] = $this->renderData($val);
            } elseif (is_array($val) || ($val instanceof Traversable)) {
                $data[$key] = $this->renderDataRecursive($val);
            } else {
                continue;
            }
        }

        return $data;
    }
protected function renderDataRecursive($data)
    {
        if (!is_array($data) && !($data instanceof Traversable)) {
            throw new InvalidArgumentException('The renderable data must be iterable.');
        }

        if (!$this->form() instanceof ObjectContainerInterface) {
            throw new RuntimeException(sprintf(
                'The [%s] widget has no data model.',
                static::CLASS
            ));
        }

        foreach ($data as $key => $val) {
            if (is_string($val)) {
                $data[$key] = $this->renderData($val);
            } elseif (is_array($val) || ($val instanceof Traversable)) {
                $data[$key] = $this->renderDataRecursive($val);
            } else {
                continue;
            }
        }

        return $data;
    }
protected function renderDataRecursive ( $ data ) { if ( ! is_array ( $ data ) && ! ( $ data instanceof Traversable ) ) { throw new InvalidArgumentException ( 'The renderable data must be iterable.' ) ; } if ( ! $ this -> form ( ) instanceof ObjectContainerInterface ) { throw new RuntimeException ( sprintf ( 'The [%s] widget has no data model.' , static :: CLASS ) ) ; } foreach ( $ data as $ key => $ val ) { if ( is_string ( $ val ) ) { $ data [ $ key ] = $ this -> renderData ( $ val ) ; } elseif ( is_array ( $ val ) || ( $ val instanceof Traversable ) ) { $ data [ $ key ] = $ this -> renderDataRecursive ( $ val ) ; } else { continue ; } } return $ data ; }
Render the given data recursively.

@param  array|Traversable $data The data to render.
@throws InvalidArgumentException If the data is not iterable.
@throws RuntimeException If the form doesn't have a model.
@return array|Traversable The rendered data.
Render the given data recursively .