protected function getDisplayRuleFields()
    {
        // Check display rules
        if ($this->Required) {
            return FieldList::create(
                LiteralField::create(
                    'DisplayRulesNotEnabled',
                    '<div class="alert alert-warning">' . _t(
                        __CLASS__.'.DISPLAY_RULES_DISABLED',
                        'Display rules are not enabled for required fields. Please uncheck "Is this field Required?" under "Validation" to re-enable.'
                    ) . '</div>'
                )
            );
        }

        $allowedClasses = array_keys($this->getEditableFieldClasses(false));
        $editableColumns = new GridFieldEditableColumns();
        $editableColumns->setDisplayFields([
            'ConditionFieldID' => function ($record, $column, $grid) use ($allowedClasses) {
                    return DropdownField::create($column, '', EditableFormField::get()->filter([
                            'ParentID' => $this->ParentID,
                            'ClassName' => $allowedClasses,
                        ])->exclude([
                            'ID' => $this->ID,
                        ])->map('ID', 'Title'));
            },
            'ConditionOption' => function ($record, $column, $grid) {
                $options = Config::inst()->get(EditableCustomRule::class, 'condition_options');

                return DropdownField::create($column, '', $options);
            },
            'FieldValue' => function ($record, $column, $grid) {
                return TextField::create($column);
            }
        ]);

        // Custom rules
        $customRulesConfig = GridFieldConfig::create()
            ->addComponents(
                $editableColumns,
                new GridFieldButtonRow(),
                new GridFieldToolbarHeader(),
                new GridFieldAddNewInlineButton(),
                new GridFieldDeleteAction()
            );

        return new FieldList(
            DropdownField::create(
                'ShowOnLoad',
                _t(__CLASS__.'.INITIALVISIBILITY', 'Initial visibility'),
                [
                    1 => 'Show',
                    0 => 'Hide',
                ]
            ),
            DropdownField::create(
                'DisplayRulesConjunction',
                _t(__CLASS__.'.DISPLAYIF', 'Toggle visibility when'),
                [
                    'Or'  => _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.SENDIFOR', 'Any conditions are true'),
                    'And' => _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.SENDIFAND', 'All conditions are true'),
                ]
            ),
            GridField::create(
                'DisplayRules',
                _t(__CLASS__.'.CUSTOMRULES', 'Custom Rules'),
                $this->DisplayRules(),
                $customRulesConfig
            )
        );
    }