Skip to content

Commit

Permalink
[TASK] Migrate grid column view element to esm (#1419)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminkott authored Aug 28, 2023
1 parent e11054b commit 1462f2f
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 132 deletions.
4 changes: 2 additions & 2 deletions Configuration/Form/FormElements/GridColumn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ prototypes:
formEditor:
translationFiles:
1686735592: 'EXT:bootstrap_package/Resources/Private/Language/FormGridColumn.xlf'
dynamicRequireJsModules:
dynamicJavaScriptModules:
additionalViewModelModules:
1686735592: 'TYPO3/CMS/BootstrapPackage/Backend/FormEditor/GridColumnViewModel'
1686735592: '@bk2k/bootstrap-package/backend/form-editor/grid-column-view-model.js'
formEditorPartials:
FormElement-GridColumn: Stage/Fieldset
18 changes: 18 additions & 0 deletions Configuration/JavaScriptModules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

/*
* This file is part of the package bk2k/bootstrap-package.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

return [
'dependencies' => [
'core',
'form',
],
'imports' => [
'@bk2k/bootstrap-package/' => 'EXT:bootstrap_package/Resources/Public/JavaScript/ESM/',
],
];
130 changes: 0 additions & 130 deletions Resources/Public/JavaScript/Backend/FormEditor/GridColumnViewModel.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Module: @bk2k/bootstrap-package/backend/form-editor/grid-column-view-model.js
*/

import $ from 'jquery';
import * as StageComponent from '@typo3/form/backend/form-editor/stage-component.js';

/**
* @private
*
* @return object
*/
function getPublisherSubscriber(formEditorApp) {
return formEditorApp.getPublisherSubscriber();
}

/**
* @private
*
* @return void
*/
function subscribeEvents(formEditorApp) {
/**
* @private
*
* @param string
* @param array
* args[0] = formElement
* args[1] = template
* @return void
* @subscribe view/stage/abstract/render/template/perform
*/
getPublisherSubscriber(formEditorApp).subscribe('view/stage/abstract/render/template/perform', function (topic, args) {
if (args[0].get('type') === 'GridColumn') {
StageComponent.renderCheckboxTemplate(args[0], args[1]);
}
});
}

/**
* @public
*
* @param object formEditorApp
* @return void
*/
export function bootstrap(formEditorApp) {
subscribeEvents(formEditorApp);
}

0 comments on commit 1462f2f

Please sign in to comment.