Using OnePlugin Media
OnePlugin Media supports two media types and adding them to your site is made super simple.
OnePlugin Media adds a custom FieldType to Craft CMS, called OnePlugin Media. OnePlugin Media works the same as PlainText or Asset fields, except that they can be configured to render two content types namely images and svgs.
A great use case for OnePlugin Media is whenever you need a field that offers content managers the ability to switch between two types of content type, or have flexibility in changing icons on the fly.
OnePlugin Media works standalone and inside Matrix blocks.
#
Adding OnePlugin MediaIt's very simple to add OnePlugin Media to your page. With two options available.
Option #1
Add OnePlugin Media as a standalone field.
Option #2
Add OnePlugin Media to a matrix block.
#
Content type configurationAllowed Content Types option restricts the field to have only certain type of contents.
The following options are available.
- All
- Allow Images
- Allow SVG Icons
By restricting content types in your template you can control and guide users in how best to use OnePlugin Media. This flexibility is even more important when you are using OnePlugin Pro or OnePlugin Fields.
#
Rendering OnePlugin MediaRendering your OnePlugin Media fields is simple, with parameters configured per asset easily within the twig file.
{{ ctaAsset.render() }}
#
ExampleThe examples below show how different content types render into the same template.
Image
SVG