Skip to content

A dropdown fieldtype that shows/hides other fields on the publish page.

Notifications You must be signed in to change notification settings

itelligence/entry_type

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Entry Type

A dropdown fieldtype that shows/hides other fields on the publish page.

This can be used to create a Tumblr-like experience. You are given the ability to select the "type" of entry, and display certain fields depending on the selected "type". For example, you first add a list of "types" to the Entry Type field: Link, Video, Image, etc. Then you create custom field(s) for each of those types for that field group. Then you can associate certain fields in that group to types, and when you select a type in the dropdown, those associated fields will show, and the others will hide.

Installation

  • Download the addon and rename the folder to entry_type
  • Copy to system/expressionengine/third_party

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.

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}

Use with Switchee:

{exp:channel:entries}
{title}<br />
{exp:switchee variable = "{your_entry_type_field}" parse="inward"}

	{case value="link"}
	{link_url}
	{/case}

	{case value="video"}
	{video}
	{/case}

	{case value="image"}
	{image}
	{/case}

{/exp:switchee}
{/exp:channel:entries}

About

A dropdown fieldtype that shows/hides other fields on the publish page.

Resources

Stars

Watchers

Forks

Packages

No packages published