Media Selector

class Nos\Renderer_Media
This renderer is used to pick a file from the media centre.
Default UI:Default UI
Hover state UI:Hover state UI
Hover state with a selected media UI:
 Hover state with a selected media UI

Configuration

property Nos\Renderer_Media::$mode

Possible values are image (default) or all.

property Nos\Renderer_Media::$inputFileThumb

Options for the inputFileThumb widget used to render the UI. See the inputFileThumb documentation for all available options.

Note

The inputFileThumb.file key will automatically be populated with the URL of the media if a value is provided in the renderer.

Methods

Nos\Renderer_Media::renderer($renderer)
Parameters:
  • $renderer (Model) – HTML attributes (name, class, id, value, etc.), with a special key renderer_options
Returns:

The <input> tag with JavaScript to initialise it

Displays a media selector in a standalone manner.

Example

Adding a media in a CRUD form configuration:

<?php

return array(
    'label' => '',
    'renderer' => 'Nos\Renderer_Media',
    'renderer_options' => array(
        'mode' => 'image',
            'inputFileThumb' => array(
            'title' => 'Title of the image',
        ),
    ),
);

Displaying a media selector:

<?php

echo Nos\Renderer_Media::renderer(array(
    'name' => 'my_image',
    'class' => 'some_class',
    'value' => 2, // ID of the previously selected media
    'renderer_options' => array(
        'mode' => 'image',
            'inputFileThumb' => array(
            'title' => 'Title of the image',
        ),
    ),
));
Read the Docs v: 0.2
Versions
latest
chiba.2
chiba.1
0.2
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.