Skip to content

ExpressionEngine Fieldtype that uses P&T Switch as a base and extends it to allow the same UI for toggling a given checkbox in a Publish/Edit form.

Notifications You must be signed in to change notification settings

focuslabllc/pt_switch_checkbox_toggle.ee2_addon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

P&T Switch: Checkbox Toggle

This fieldtype uses Pixel & Tonic’s P&T Switch fieldtype as a base and extends it to allow the same UI for toggling a given checkbox in a Publish/Edit form. You just need to know the input name of the checkbox and setup the field settings accordingly.

Purpose

I built this so we could use the P&T Switch UI on the “Allow Comments” field and “Entry is Sticky” field in publish forms. The goal was a more consistent UI for the content managers.

Compatibility

Only tested on EE 2.2.2 with P&T Switch 1.0.4

Installation

  • Move the pt_switch_checkbox_toggle folder into your expressionengine/third_party folder
  • Go to Fieldtypes → P&T Switch: Checkbox Toggle → Install

Setup

Create a new custom field and select the P&T Switch: Checkbox Toggle fieldtype. Visually this will be no different from the standard P&T Switch fieldtype on the Publish/Edit form.

In your fieldtype settings be sure to enter the name of the checkbox input. An example would be allow_comments to use the P&T Switch UI for ExpressionEngine’s native “Allow Comments” form checkbox.

What it does

This fieldtype allows you to define which input to select. It hides that input’s label on the Publish/Edit page and using javascript to update the input’s “checked” attribute when the P&T Switch UI is used. It also runs a small check to see if it’s in the correct state.

Technically you end up with 2 fields containing similar data. In the example above, you will have a custom field with a value of ‘y’ along with EE’s native allow_comments field set to TRUE.

About

ExpressionEngine Fieldtype that uses P&T Switch as a base and extends it to allow the same UI for toggling a given checkbox in a Publish/Edit form.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages