Single Media selection ====================== Description ----------- Shows a list with the possibility to assign a single asset from the media section to a page. Also allows to define a position, which can be handled later in the template. Parameters ---------- .. list-table:: :header-rows: 1 * - Parameter - Type - Description * - types - string - A comma separated list of available asset types to assign. Each item in the list must be one of ``document``, ``image``, ``video`` or ``audio``. * - displayOptions - collection - A collection of booleans, which defines to which positions the assets can be assigned (``leftTop``, ``top``, ``rightTop``, ...) * - defaultDisplayOption - string - Defines which of the displayOptions is the default one Return value ------------ See the Media_ object for available variables and functions. Example ------- .. code-block:: xml Document Extended Example ---------------- .. code-block:: xml Image Twig ---- .. code-block:: twig {% set image = content.image %} {{ image.title }} If your property defines ``displayOptions`, you can access the selected ``displayOption`` via ``view..displayOptions``: .. code-block:: twig {% set image = content.image %}
{{ image.title }}
If you want to provide a link for downloading a document, you can use ``.url`` attribute or wrap it with the :doc:`../twig-extensions/functions/sulu_get_media_url` to control which `disposition header`_ the target url should use: .. code-block:: twig