public function getFirstImage($content)
    {
        Deprecated::method('3.4');

        $contentType = $content->getContenttype();
        if (!$contentType instanceof ContentType) {
            return null;
        }
        $fields = $contentType->getFields();
        if (!is_array($fields)) {
            return null;
        }

        // Grab the first field of type 'image', and return that.
        foreach ($fields as $key => $field) {
            if ($field['type'] === 'image' && is_array($content->get($key))) {
                return $content->get($key);
            }
        }

        // otherwise, no image.
        return null;
    }
public function getFirstImage($content)
    {
        Deprecated::method('3.4');

        $contentType = $content->getContenttype();
        if (!$contentType instanceof ContentType) {
            return null;
        }
        $fields = $contentType->getFields();
        if (!is_array($fields)) {
            return null;
        }

        // Grab the first field of type 'image', and return that.
        foreach ($fields as $key => $field) {
            if ($field['type'] === 'image' && is_array($content->get($key))) {
                return $content->get($key);
            }
        }

        // otherwise, no image.
        return null;
    }
public function getFirstImage ( $ content ) { Deprecated :: method ( '3.4' ) ; $ contentType = $ content -> getContenttype ( ) ; if ( ! $ contentType instanceof ContentType ) { return null ; } $ fields = $ contentType -> getFields ( ) ; if ( ! is_array ( $ fields ) ) { return null ; } // Grab the first field of type 'image', and return that. foreach ( $ fields as $ key => $ field ) { if ( $ field [ 'type' ] === 'image' && is_array ( $ content -> get ( $ key ) ) ) { return $ content -> get ( $ key ) ; } } // otherwise, no image. return null ; }
Gets the first image from the given content record.

This method is deprecated. In Bolt 3.5 it'll be replaced / removed to
fall in line with the work done for #6985

@param \Bolt\Storage\Entity\Content $content

@return array|null image
Gets the first image from the given content record .