Giter Club home page Giter Club logo

entry_type's Introduction

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

  • Requires PHP 5.3
  • Download the addon and rename the folder to entry_type
  • Copy to system/user/addons
  • Install the addon

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

  • Short Name - the value of the field, for use in templates and conditionals
  • Label - the label for the value
  • Hide Fields - choose the fields to hide when the specified value is chosen

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}

entry_type's People

Contributors

allmarkedup avatar jrrdnx avatar leevigraham avatar litzinger avatar loren138 avatar noellekimiko avatar pyrobob83 avatar rsanchez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

entry_type's Issues

1.0.6 hides one types fields but not another

Hey Rob,

Trying out entry type 1.0.6 but it seems to have an issue.

I have two entry types and i'm using a select dropdown to show/hide my types. If i go to my entry, i can show one type and it's fields, but not the other. It doesn't show any fields at all when i select it. I've gone back to 1.0.4 for now and to hell with Field Editor compatibility! :)

Cheers,
John

Conflict with publish layouts in EE 2.6.1 and Entry Type 1.0.7

I just updated to the 1.0.7 version of Entry Type to be compatible with EE 2.6.1 and seem to be running into conflicts with the Publish Layouts. Here's what I've noticed:

  1. Create an Entry Type field and hide some fields for each entry type.
  2. Go publish an entry in the channel that uses this entry type field and the field works as expected.
  3. Go back and start to publish another entry in the same channel, but use the publish layouts to remove some tabs, such as the "Categories" and "Pages" tabs.
  4. You don't need to actually publish this entry - you can go back to the CP home page.
  5. Now go back and try to create another entry in the same channel. The entry type field doesn't work as expected anymore because some of the fields are now permanently hidden by the publish layout options (i.e. the little eye next to the fields is closed for some fields). I'm not sure why some fields are hidden and some aren't. So now if I use the entry type field, it works but it doesn't show all the fields that it should for each choice.
  6. The only way to fix it that I've found so far is to reset the publish layout and leave it alone. If I try to remove tabs or do anything with publish layouts it hides fields again.

Let me know if you need any more details or if you can reproduce this issue. I've noticed this on two sites so far.

Allow option_name : Option Label

Would be great if you allowed for option_name : Option Label naming like PT Fieldpack fieldtypes.

Also great would be a replace_all_options, replace_selected, like PT Multi fieldtypes.

I started a fork but got sidetracked, so I'm putting it here :)

Field Editor Compatibility issue with selected hidden fields not being all selected

Hi Rob,

So, when using it with "Field Editor" and it brings up Entry_Types field options in the modal window, only one of the custom fields is ever selected in the "hide fields" cell per type. So, i have a "type" and that type has 4 custom fields set to be hidden. However when used with field editor, only one of those custom fields is selected. If i look at the entry_type custom field in the normal EE custom field area, it shows all 4 custom fields selected in the hide fields cell.

Cheers

John

Alternate types

Can we have the option of tying this to Checkbox Groups or Radio Groups?

Grid fields are not hidden

Hello,

On EE 4.1+ it seems that fields of the native Grid type are not hidden even though they are marked to do so properly. The functionality works as expected with other fields.

Crashing with too many fields

Hi Rob,

Thanks for this add-on, it's been very useful to me for the last couple years. I have an site where I have over 250 custom fields and 100 different Entry Type settings in a single channel. This site is still on EE2 and it seems it's the add-on has been pushed beyond it's limits. When adding a new entry type and submitting it, only a few of the entry type settings will be submitted.

Have you run into an instance with this many custom fields? I can try upgrading to EE3, but are there any workarounds that I could do?

Thanks if you have any tips!

Can't delete newly-created Entry Types

When creating new Entry Types, the trash can doesn't trigger the removal of the row until after the field settings have been saved.

I thought that some delegate() might fix this, and tried for a few minutes, but JS is a weak spot for me, so I gave up.

Unselect fields to hide

It would be helpful if you could unselect items to hide. I found in one instance that I needed every field visible in one of my entry types but currently the only way to unselect every field is to delete and recreate the field and make sure I don't select anything from the start.

Also, would it be possible to have the alert pop-up add a save entry option to the stay on page/leave page options?

Extension CP error with MSM

Hey Rob,

In working with the extension > statuses aspect of your module, I'm getting attached error in any non-primary MSM site. I can view/use as expected in MSM's primary site. Might there be a fix? Could also be something on my end too.

Let me know when you can. Thanks,

Colin

screen shot 2016-06-05 at 3 49 45 pm
screen shot 2016-06-05 at 3 52 17 pm

v1.1.0 only obeys 1 of 2 rules

For Entry Type settings, I have 2 rules both under the 'Page' channel and 'Template' field.

Rule 1: For every template except 'faq', hide the FAQ field.
Rule 2: For every template except 'partners', hide the Partners field.

Now when I add/edit any entry using the 'faq' template, I can see the FAQ field but not the Partners field (correct). And when I add/edit any entry using the 'partners' template, I can see the Partners field but not the FAQ field (correct). But for every other Page channel entry using a template that is not 'faq' or 'partners' I can still see the FAQ field.

EE3: All Tabs are hidden on Publish page?

I'm not sure if this behavior was intentional or not, but in the EE3 version, all the tabs are hidden from the Publish page. I'd like to still be able to access the other tabs like Structure and Revisions.

The main issue seems to be this block of code starting on line 42 of EntryType.js. It's adding the attribute style="display: none;" to all of my tab items:

$tabs.each(function() {
        var id = this.id.replace(/^menu_/, ""),
            $tab = $(this),
            $fieldset = $("#"+id),
            $visibleFields = $fieldset.find(".publish_field").filter(function() {
              return $(this).css("display") !== "none";
            });

        $tab.toggle($visibleFields.length > 0);
      });

Maybe the tab layout has changed in EE3? None of the tabs have IDs and I don't have any elements with the class publish_field

Entry Types shows fields hidden by Publish Layouts.

I'm hiding some fields with the "closed eye" icon in Publish Layouts (via the Toolbar on a Publish Form).

When an Entry Types field is included on the Publish Form, all my fields hidden by Publish Layouts are shown, even though the "closed eye" icon is correctly saved/shown for the hidden fields.

I'm guessing this has to do with the way Entry Types makes fields to show that is overriding the Publish Layouts hidden fields settings.

Any way to make Entry Types respect hidden fields in Publish Layout settings?

Installation notes

Rename to entry_TYPE
Fieldtypes > Install

Looks a very useful add on , we were going to build exactly this but you got there first! Great work, thanks!

Multiple Entry Type fields?

Long the concept of this!

I would love to use it to build a "widget" collection for entries -- toggle a group of fields on or off.

Example:

Entry Type field #1 is a "On/Off" switch. Turning it ON reveals A,B,C custom fields.
Entry Type field #2 is a "On/Off" switch. Turning it ON reveals X, Y custom fields.

However, right now this only supports 1 Entry Type field per Publish Form, correct?

Any chance on seeing multiple Entry Type fields support?

Thanks for the great work!

File Upload doesn't work if hidden by default

I get this error in firebug: TypeError: $(...).tablesorter is not a function

I'm using a file upload field within matrix. By default, the matrix field is hidden. When I choose an entry type option that then shows the field, the file upload doesn't work - nothing happens and I get the above error.

This only happens when the file field is within Matrix.

If I remove the entry type field, this works just fine.

Any ideas?

Thanks!!!

Issue with EE 2.10.1 perhaps?

Hi

I'm getting console errors on the Create A New Field page when trying to create new fields, that occurred after trying to use entry type:

2015-05-14_16-16-26

This seems to be stopping field options from loading....for any field type! E.g. I change field type to assets, and nothing happens below...

Any ideas on this one? Has kinda crippled my dev :(

Error 500

I decided to use you GREAT plugin as chooser for my matrix fields assigned to channels. I have created 21 type and there is selection of 21 matrix fields. All works fine except 6 types. Is there restriction on how many types you can have (15). Can i override it so I can have as many as I want?

typefield

PHP error when type has no fields hidden

If a type is created where there are no fields selected in the hide fields column, the value of $data['hide_fields'] is classed as undefined instead of null.

The following error appears on the edit field page:

A PHP Error was encountered
Severity: Notice
Message: Undefined index: hide_fields
Filename: views/options.php
Line Number: 13

And the following error appears on the edit entry page:

A PHP Error was encountered
Severity: Notice
Message: Undefined index: hide_fields
Filename: entry_type/ft.entry_type.php
Line Number: 111

Conflict with Low Search

I've opened an issue with Low Search as well here.

I'm not sure which plugin is the issue, but Low Search and Entry Type don't seem to work well together. When they are both enabled I get errors on both the Publish/Edit and New Channel Field pages, it seems to be related to jQuery, so I tried enabling the jQuery module but it didn't fix the issue.

It looks like the control panel is requesting an file at /index.php?S=fa7404b35bdd825d2331b40db76526fc&D=cp&C=javascript&M=load&package=low_search&file=EntryType which is returning an error page saying jQuery cannot be found. Which then results in an error in the console saying Uncaught SyntaxError: Unexpected token >

I get another error, which I believe is caused by the first error saying Uncaught ReferenceError: EntryTypeFieldSettings is not defined.

Cheers!

EE6 support?

Is this add-on still in development? Getting some JS errors in EE6 admin.

EE 3.xx version?

Do you know if entry_type works wth EE 3.4 and if not any plans to upgrade? If not any willingness to develop for fee?

Required Fields

Hi Rob,

You might be the king of sick add-ons! Loving the active record one. Didn't realize this was you too.

Anyways - a question. Does entry_type consider required fields? I have member fields (using Zoo Visitor dedicated channel) that I want to negotiate slightly different fields for a Coach vs. Player. I want them to be required for each respectively (so all fields are required). However, when editing a channel entry, for say a player, I want to avoid being prompted to insert the field values that are required for a coach.

Let me know thoughts.

Thanks in advance,

Colin

Upgraded to 1.1.1 and existing field type seems broken

Hi there,
I'm on EE 2.5.3 and upgraded the Entry type plugin to version 1.1.1. However, the channels where I already had a field setup to show/hide custom fields on the publish page appears broken.

I can choose a different type but it's not showing the relevant fields. i've checked the field setting and it is still correctly set.

I would be grateful for any advice on this.

Radio buttons don't trigger hide

On latest version of EE (2.3.1), the radio button mode doesn't seem to trigger the js to hide the fields. Dropdown works fine though.

Unable to create new channel fields in EE 2.8.1

I installed Entry Type into my test site using v 2.8.1 of EE, and whenever I go to create a new channel field now, I only get a page with this error Unable to load the requested language file: language/english/entry_type_lang.php

The file exists at that path, and I checked file permissions and that's not the issue, so I'm clueless.

Update: this is the error you get if you don't rename the add-on folder, didn't see this instruction on Devot:ee.

PHP Error after update to EE 2.8, and update to Entry Type

UPDATE: It works fine if I set it up through native Channel Fields, so seems to be an issue when setup through Field Editor addon.

After updating to Expression Engine 2.8, I am getting errors after creating a new field.

  • Updated EE
  • Updated addon
  • Created new Entry Type field in a new field group
  • Saved (I use field editor add on). All seemed fine
  • Created new entry and get the following displaying at the top of the entry…
A PHP Error was encountered
Severity: Notice
Message: Undefined index: type_options
Filename: entry_type/ft.entry_type.php
Line Number: 106
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: entry_type/ft.entry_type.php
Line Number: 106
A PHP Error was encountered
Severity: Notice
Message: Undefined index: type_options
Filename: entry_type/ft.entry_type.php
Line Number: 115
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: libraries/Entry_type.php
Line Number: 116
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /path/to/system/codeigniter/system/core/Exceptions.php:170)
Filename: core/Common.php
Line Number: 446

When I return the field settings are reset to the default, as if I had just created the field. The field is displaying blank, with none of the options I have saved previously.

Thanks for your help!

Shouldn't hide non-Entry-Type fields

Currently the plugin hides all custom fields, even ones that are not part of an Entry Type type. I'd like to be able to have some fields always visible, and then some show/hide with Entry Type.

Entry Type 1.1.2 conflict with Pages module

I first had the version 1.1.1 and everything was fine but then I installed version 1.1.2 and I started having issues with the Pages module. Basically the issue is the following:

When you are editing an entry, if you don't specify the channel_id parameter in the URL, the javascript variable EntryType doesn't get defined and therefore everything else seems to fails.
Since the Pages module only specifies the entry_id in each one of the links, then the module entry type always fails for every page.

Please let me know if you can find and issue for this bug.

Thanks!

PHP warning with certain field types on field settings screen

Looks like a hiccup in convert_old_settings, $vars isn't set.
This only seems to happen for me when viewing a settings for a field of certain types (seems like all PT fieldpack types)..

Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: entry_type/ft.entry_type.php
Line Number: 212

Default Radio Button?

How do you feel about making the first radio button selected by default (this is how the dropdown behaves), so that one set or the other will be hidden on page load?

Performing the opposite of expected result

I setup an entry type field with two options. One option showed one field and another option showed all the fields. However, when I go to the publish form the fields displayed are opposite of what's currently selected. What's even more strange the common field to both isn not displayed at all, regard less of what's selected. Having this problem in EE 2.5.5 and the most current version of entry type.

"EntryType is not defined" error

Hi Rob,

Just installed and tried out the EE4 version. It installed without a hitch but the Entry Type field is not hiding the others:

ee4_entry_type_bug

Looks like I'm getting a jQuery error:

ee4_entry_type_jquery_error

Currently running EE 4.1.2 on a Bootstrap 4 based site.

Thanks a bunch!

Very slow page load on minimal pages.

I created a channel hiding almost all except the required fields in the profile and the page is very slow to render with my addition of an entry_type fieldtype. My field group has the following name and types:

Type            Entry Type
Page            Playa
Internal URL    Text Input
External URL    Text Input
Sub Navigation  Playa

Entry type has four P&T pill options. Page, Internal URL, External URL, and Sub Navigation.

I'll try to play with the javascript file to benchmark it but I guess it's selecting way too many elements in the DOM.

Thanks for your help Rob. The fieldtype is very useful for us.

Entry Types hides "Default html Buttons"

the default html buttons are not shown anymore above the textarea fields.
I've checked the console but found no javascript errors.

otherwise it's a great add-on - love it!

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.