Giter Site home page Giter Site logo

m8brgarc / craft-elementoptions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from timkelty/craft-elementoptions

0.0 1.0 0.0 979 KB

Craft CMS Plugin: Checkbox Selection + Elements

License: MIT License

PHP 64.24% CSS 2.07% JavaScript 11.13% HTML 22.57%

craft-elementoptions's Introduction

ElementOptions plugin for Craft CMS

ElementOptions fieldtypes function similar to the native Checkboxes fieldtypes, with the addition of a selected element to each option. Each element type is supported with it's own fieldtype: Assets, Users, Entries, and Categories.

Screenshot

Why

The intital need for this plugin was to create a "layout selection" field. While a radio buttons field would do the trick, we wanted to be able to show a selectable image instead of a checkbox and text.

The most applicable element type is Assets, as it allows you to create a field where users can select from a pre-defined set of Assets.

Screenshot

Installation

  • Via Composer: composer require timkelty/craft-elementoptions
  • Git: git clone https://github.com/timkelty/craft-elementoptions.git craft/plugins/elementoptions
  • Download & unzip the into craft/plugins/elementoptions directory

ElementOptions works on Craft 2.4.x and Craft 2.5.x.

Settings

Screenshot

See Craft Docs for Checkboxes Fields / Settings.

  • Limit the number of selectable options
  • Select an element for each option, and how that element will be displayed (thumbnails, label, checkbox)
  • Option Label and Value may contain tags that reference the selected entry, such as {title} or {slug}. This can be useful if you want the label/value to change with element, and vice-versa.

Templating

See Craft Docs for Checkboxes Fields / Templating.

  • option.element is available. It will return an ElementCriteriaModel.
<ul>
    {% for option in entry.elementOptionsFieldHandle %}
        <li>{{ option.element.first().title }}</li>
    {% endfor %}
</ul>

craft-elementoptions's People

Contributors

timkelty avatar m8brgarc avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.