Media

Use the media type to link to a file in the media library.

Included in the PerformMediaBundle.

Options

label

The label to use for form labels and table headings. If no label is provided, a sensible label will be created automatically.

This option is optional.

Allowed types: string

Defaults:

  • List context: No default
  • View context: No default
  • Create context: No default
  • Edit context: No default

types

The type of media to choose from. Each entry should refer to the name of a plugin.

This option is optional.

Allowed types: array, string

Defaults:

  • List context: []
  • View context: []
  • Create context: []
  • Edit context: []

use_selector

If true, use the media selector modal to choose media.

You may use a bare string instead of an array to use only one plugin.

If no types are supplied, all media will be available.

This option is optional.

Allowed types: boolean

Defaults:

  • List context: true
  • View context: true
  • Create context: true
  • Edit context: true

Example

<?php
$config->add('image', [
    'type' => 'media',
    'options' => [
        'types' => 'image',
        // same as
        // 'types' => ['image'],
    ],
    'contexts' => [
        CrudRequest::CONTEXT_LIST,
        CrudRequest::CONTEXT_EDIT,
    ],
])