src/Sulu/Bundle/PageBundle/Teaser/ContentTeaserProvider.php
private function getMedia(Document $document, $field)
    {
        $images = json_decode($document->getField($field)->getValue(), true);

        if (!array_key_exists('ids', $images) || 0 === count($images['ids'])) {
            return;
        }

        return $images['ids'][0];
    }
private function getMedia(Document $document, $field)
    {
        $images = json_decode($document->getField($field)->getValue(), true);

        if (!array_key_exists('ids', $images) || 0 === count($images['ids'])) {
            return;
        }

        return $images['ids'][0];
    }
private function getMedia ( Document $ document , $ field ) { $ images = json_decode ( $ document -> getField ( $ field ) -> getValue ( ) , true ) ; if ( ! array_key_exists ( 'ids' , $ images ) || 0 === count ( $ images [ 'ids' ] ) ) { return ; } return $ images [ 'ids' ] [ 0 ] ; }
Returns media-id.

@param Document $document
@param string $field

@return int|null
Returns media - id .