rsanchez / entry_type

A dropdown fieldtype for ExpressionEngine 3 that shows/hides other fields on the publish page.
http://devot-ee.com/add-ons/entry-type/
47 stars 21 forks source link

Entry Type

An ExpressionEngine 4 add-on for hiding publish fields on a conditional basis. The Entry Type fieldtype creates a dropdown field which can hide other publish fields depending on the value chosen.

Use the ee2 branch for an EE2 compatible version. Structure/Pages module compatibility has been removed in the EE3 version.

Use the ee3 branch for an EE3 compatible version.

Installation

Fieldtype Tags

{your_field_name}

The short name for the entry type selected.

{your_field_name:label}

The label for the entry type selected.

{if {your_field_name:selected option="link"}}

Check whether the specified option is selected. (Use the short name).

{your_field_name all_options="yes"}
    {option} {option_name} {label} {selected}
{/your_field_name}

List all your options.

Fieldtype Settings

Examples

Displaying different content based on entry type.

{exp:channel:entries}
{title}<br />
{your_entry_type_field:label}<br />
{if your_entry_type_field == 'link'}
    {link_url}
{if:else your_entry_type_field == 'video'}
    {video}
{if:elseif your_entry_type_field == 'image'}
    {image}
{/if}
{/exp:channel:entries}