Project

General

Profile

Actions

Feature #88925

open

additionalElementPropertyPaths for Inspector-CheckEditor

Added by Jonas Schwabe over 4 years ago. Updated over 4 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2019-08-06
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

The additionalElementPropertyPaths property is currently only available for TextEditor https://docs.typo3.org/c/typo3/cms-form/master/en-us/I/Config/proto/formElements/formEditor/inspectorEditors/TextEditor.html#additionalelementpropertypaths

We had a use case today where we wanted to implement a validator that can be configured using checkboxes. To make sure we were able to have frontend validation we wanted to be able to set element properties as well (to pass those values to the frontend).

Implementing this feature is actually pretty simple so we created out own Inspector element for that which could probably go into ext:form directly:

       function renderPropagatingCheckboxEditor(editorConfiguration, editorHtml, collectionElementIdentifier, collectionName) {
          // Code from original renderCheckboxEditor

          $('input[type="checkbox"]', $(editorHtml)).on('change', function() {
            if (
              !getUtility().isUndefinedOrNull(editorConfiguration['additionalElementPropertyPaths'])
              && 'array' === $.type(editorConfiguration['additionalElementPropertyPaths'])
            ) {
              for (var i = 0, len = editorConfiguration['additionalElementPropertyPaths'].length; i < len; ++i) {
                if (
                  !!editorConfiguration['doNotSetIfPropertyValueIsEmpty']
                  && !($(this).is(":checked"))
                ) {
                  getCurrentlySelectedFormElement().unset(editorConfiguration['additionalElementPropertyPaths'][i]);
                } else {
                  getCurrentlySelectedFormElement().set(editorConfiguration['additionalElementPropertyPaths'][i], ($(this).is(":checked")));
                }
              }
            }
          });
        };
Actions #1

Updated by Jonas Schwabe over 4 years ago

  • Description updated (diff)
Actions

Also available in: Atom PDF