Using OnePlugin Fields
OnePlugin Fields supports nine different media types, adding them to your Craft project and configuring them to your site is super simple.
OnePlugin Fields adds a custom FieldType to Craft CMS, called OnePlugin Fields. This functions in the same way as a PlainText or Asset field, but you can configure this field to render nine different content types, including
- Images,
- Animated icons
- Videos
- [Customisable SVGs](features/adding-svg-icon]
- Social posts
- Website previews
- Third party marketing forms
- GoogleMaps
- PDFs
- Office documents
One of our favourite usecases for OnePlugin Fields has to be truely customisable blog templates. This gives content managers the ability to switch between between different types of media. More importantly, it allows for content to be generated from within the control panel. All while optimising the media type so it's served as efficiently as possible.
OnePlugin Fields works standalone and inside matrix blocks.
#
Adding OnePlugin FieldsIt's very simple to add OnePlugin Fields to your page. There are two ways to do this.
Option #1
Add OnePlugin Fields as a standalone field.
Option #2
Add OnePlugin Fields to a matrix block.
#
Field media type content configurationConfigure what media types are allowed to your OnePlugin Fields from your field settings. Restrict the template sections utilising OnePlugin fields to specific content types. Why you ask? In order to provide flexible content that works with your sites design guidelines and container styles.
The following options are available:
- All
- Allow Images
- Allow Videos
- Allow Social Media Content
- Allow Websites
- Allow Google Maps
- Allow Animated Icons
- Allow SVG Icons
- Allow PDF Documents
- Allow Office Documents
Configure each block individually in order to provide users guidelines and bring value to your clients site.
#
Rendering OnePlugin FieldsRendering OnePlugin Fields is simple, check out features for media specific code examples.
{{ ctaAsset.render() }}
OnePlugin Fields require jQuery and some other Javascript libraries to render contents types like Animated Icons, PDF, Google Maps etc.
#
Configuring your twig filesAdd the below code snippet to your Twig file preferably in the Footer.
{{ craft.onePluginFields.includeAssets(true,true,true) }}
- includejQuery - Will include jQuery library. Default is false
- includePDF - Will include PDF library required to render PDF files. Set this to true only if PDF's are used in the page. Default is false
- includeMap - Will include Google Maps library required to render Maps. Set this to true only if Maps are used in the page. Default is false
#
ExampleThese examples show how the same field is rendered using different media types.
Image
Video
Website
Animated Icon
SVG
Office Document