Download the PHP package billythekid/conditional-fields without Composer

On this page you can find all versions of the php package billythekid/conditional-fields. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package conditional-fields

NOTE:

This plugin was a stop-gap measure. Mats has ported Reasons for Craft 3 along with this note in the Craft Discord:

I decided to finally port it from Craft 2, primarily to make it easier to upgrade Craft 2 sites using it. I'd avoid using it for new Craft 3 builds, since there's no guarantee it'll be possible/feasible to migrate Reasons conditionals to core conditionals, once Craft 4 drops On the other hand, "soon" is a very relative term... Back when 3.0 released, I'd never guessed it'd take 3-4 years before field layout conditionals would make it to core. Also, we still don't actually know when Craft 4 is coming out :slight_smile:

Brandon also added:

There's been a change of plans re v4 in light of … everything. Originally v4 was to be our main focus this year, but now we don't think the timing is right for a breaking update like that. So we're working to add as many of the v4 features into v3 as we can w/out breaking things, hopefully including conditional fields. It's a bit more slow going because brownfield, but we think it's the right call.

So unless you really need conditional fields I'd suggest waiting for it to come into core. If you really really need them, first use Reasons and only if you need the dumbest implementation use this. You've been warned!

Conditional Fields plugin for Craft CMS 3.x

Conditional Fields Overview

Show or hide fields or tabs of fields based on the value of other fields. PRs gratefully received.

Easy now, this is probably not all you hoped it would be when you saw it was released! That said, please post any issues you're having and I'll check them out.

Conditional field layouts are coming to Craft CMS version 4 core. Craft CMS version 2 had the Reasons plugin but there's nothing working for Craft 3 at the moment.

Reasons is back! I strongly suggest using that plugin instead of this one!

This is a very simple, very dumb, implementation of a way to get conditional field layouts in your entries etc.

If you need something complex it's almost certainly not possible with this plugin, but if you just need to show and hide some fields based on simple selections, like light switches, give it a whirl.

Requirements

This plugin requires Craft CMS 3.4.10 or later. It may work on earlier (^3.0) versions but I've not tested it. I haven't restricted installation to 3.4.10 so give it a go!

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

    cd /path/to/project
  2. Then tell Composer to load the plugin:

    composer require billythekid/conditional-fields
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Conditional Fields.

Using Conditional Fields

This plugin adds a new available field type called "Conditional".

Creating a conditional field to show/hide fields:

Creating a conditional field to show/hide tabs:

To check for an entry in an entry field, use 'contains' and put the entry ID as the value.

NOTE: Chances are that this won't work inside a matrix block or other complicated stuff. Keep it simple.

Once your conditional field is created you can drag it in to any field layouts you want it to work in.

The field itself is invisible to your layout. There are no settings or values to be saved in the layout view, we're just adding functionality so we hide it.

Example of showing/hiding fields:

Example of showing/hiding tabs:

Dos and Don'ts

Do…

Don't…


All versions of conditional-fields with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^3.0.0-RC1
codeonyii/yii2-at-least-validator Version ^1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package billythekid/conditional-fields contains the following files

Loading the files please wait ....