PHPackages                             oveleon/contao-be-field-dependency - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. oveleon/contao-be-field-dependency

Abandoned → [oveleon/contao-be-field-dependency](/?search=oveleon%2Fcontao-be-field-dependency)ArchivedContao-bundle[Utility &amp; Helpers](/categories/utility)

oveleon/contao-be-field-dependency
==================================

Allows to control the output of DCA fields via a condition.

0.4.2(4y ago)1841MITPHPPHP ^7.4 || ^8.0

Since Oct 22Pushed 4y ago2 watchersCompare

[ Source](https://github.com/oveleon/contao-be-field-dependency)[ Packagist](https://packagist.org/packages/oveleon/contao-be-field-dependency)[ Docs](https://www.oveleon.de/)[ RSS](/packages/oveleon-contao-be-field-dependency/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (7)Used By (1)

Contao Backend Field Dependency
===============================

[](#contao-backend-field-dependency)

In addition to palettes and sub-palettes, this extension adds a new field property (`dependsOn`) for DCA's where conditions can be defined to display the field.

#### Condition based on another field and its value:

[](#condition-based-on-another-field-and-its-value)

```
'field1'  => [
    'exclude'    => true,
    'inputType'  => 'checkbox',
    'eval'       => ['tl_class' => 'w50 m12'],
    'sql'        => "char(1) NOT NULL default '0'",
],
'field2'  => [
    'exclude'    => true,
    'inputType'  => 'text',
    'eval'       => ['maxlength'=>64, 'tl_class'=>'w50'],
    'sql'        => "varchar(64) NOT NULL default ''",
    'dependsOn'  => [
        'field1' => 1 // Displays this field only if the checkbox (field1) has been selected.
    ]
],
```

#### Condition based on another field and a custom callback:

[](#condition-based-on-another-field-and-a-custom-callback)

```
'field2'  => [
    'exclude'    => true,
    'inputType'  => 'text',
    'eval'       => ['maxlength'=>64, 'tl_class'=>'w50'],
    'sql'        => "varchar(64) NOT NULL default ''",
    'dependsOn'  => [
        'field1' => static function($fieldName, $objModel) {
            // $fieldName = field1
            // "field1" is automatically supplemented with the field evaluation "submitOnChange = true" (autoSubmit = true).

            // Return true = show / false = hide
            return $objModel->{$fieldName} == 1;
        }
    ]
],
```

With this variant, the specification of the field name to be reacted to is optional. Please note that the first parameter corresponds to the given key.
For example:

```
'field2'  => [
    'exclude'    => true,
    'inputType'  => 'text',
    'eval'       => ['maxlength'=>64, 'tl_class'=>'w50'],
    'sql'        => "varchar(64) NOT NULL default ''",
    'dependsOn'  => [
        static function($fieldName, $objModel, &$arrEvaluationFields) {
            // $fieldName = 0
            // 'field1' must be extended independently with the field evaluation 'submitOnChange = true' or added via the third parameter ($arrFields) (autoSubmit = true).
            $arrEvaluationFields[] = 'field1';

            // Return true = show / false = hide
            return $objModel->field1 == 1;
        }
    ]
],
```

#### Multiple conditions:

[](#multiple-conditions)

```
'field1'  => [
    'exclude'    => true,
    'inputType'  => 'checkbox',
    'eval'       => ['tl_class' => 'w50 m12'],
    'sql'        => "char(1) NOT NULL default '0'",
],
'field2'  => [
    'exclude'    => true,
    'inputType'  => 'checkbox',
    'eval'       => ['tl_class' => 'w50 m12'],
    'sql'        => "char(1) NOT NULL default '0'",
],
'field3'  => [
    'exclude'    => true,
    'inputType'  => 'text',
    'eval'       => ['maxlength'=>64, 'tl_class'=>'w50'],
    'sql'        => "varchar(64) NOT NULL default ''",
    'dependsOn'  => [
        'field2' => 1,
        'field3' => 1 // Both fields must be checked to display this field
    ]
],
```

### Configuration

[](#configuration)

Basic settings must be maintained via the config/config.yml file.

```
contao_be_field_dependency:
    autoSubmit: true
    tables:
        - tl_article
        - tl_content
        - tl_files
        - tl_form_field
        - tl_form
        - tl_image_size_item
        - tl_image_size
        - tl_layout
        - tl_member_group
        - tl_member
        - tl_module
        - tl_opt_in
        - tl_page
        - tl_style
        - tl_style_sheet
        - tl_theme
        - tl_user_group
        - tl_user
```

ParameterDefaultDescription`autoSubmit`trueReferenced fields in `dependsOn` automatically get the "submitOnChange" evaluation set. Should this parameter be set to `false`, the evaluation must be added manually.`tables`(see above)List of tables where `dependsOn` may be taken into account. If you add your own tables, the default settings will be overwritten and you will have to set them yourself.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~37 days

Recently: every ~45 days

Total

6

Last Release

1476d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/acb45ab67207e71f4495c84d405e09a9de7ea11f7645c3de802d9abb3691efa0?d=identicon)[oveleon](/maintainers/oveleon)

---

Top Contributors

[![doishub](https://avatars.githubusercontent.com/u/48379929?v=4)](https://github.com/doishub "doishub (12 commits)")

---

Tags

contaobackenddcacondition

### Embed Badge

![Health badge](/badges/oveleon-contao-be-field-dependency/health.svg)

```
[![Health](https://phpackages.com/badges/oveleon-contao-be-field-dependency/health.svg)](https://phpackages.com/packages/oveleon-contao-be-field-dependency)
```

###  Alternatives

[mvo/contao-group-widget

Adds a new group widget that allows repeating a set of DCA fields.

28124.3k31](/packages/mvo-contao-group-widget)[terminal42/contao-inserttags

Contao extension to create custom insert tags.

1048.5k](/packages/terminal42-contao-inserttags)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
