Skip to content

Commit

Permalink
see cl
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Kunitzsch committed Aug 28, 2019
1 parent f63b5c5 commit 769e3e8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.

## [2.3.0] - 2019-08-28
### Added
- dcaPicker support for input fields

### Fixed
- fixed load_callback

## [2.2.2] - 2019-08-27

### Fixed
Expand Down
5 changes: 4 additions & 1 deletion src/Resources/views/multi_column_editor_default.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
{% if widget.type == "hidden" %}
{{ widget.parse()|raw }}
{% else %}
<div class="{{ ('form-group ' ~ field ~ (widget.datepicker|default() ? ' wizard' : '') ~ (isBackend ? ' col' : '')) | trim }}" data-name="{{ widget.noIndex }}"{% if widget.groupStyle|default() %} style="{{ widget.groupStyle }}"{% endif %}>
{% if widget.datepicker|default or widget.dcaPicker|default %}
{% set wizard = ' wizard' %}
{% endif %}
<div class="{{ ('form-group ' ~ field ~ wizard|default ~ (isBackend ? ' col' : '')) | trim }}" data-name="{{ widget.noIndex }}"{% if widget.groupStyle|default() %} style="{{ widget.groupStyle }}"{% endif %}>
{{ widget.parse()|raw }}
</div>
{% endif %}
Expand Down
24 changes: 24 additions & 0 deletions src/Widget/MultiColumnEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Contao\BackendTemplate;
use Contao\Controller;
use Contao\Date;
use Contao\Environment;
use Contao\StringUtil;
use Contao\System;
use Contao\Widget;
Expand Down Expand Up @@ -488,6 +489,29 @@ protected function handleSpecialFields(Widget $objWidget, array $arrData, string
</script>';
}

// dca picker
if ($arrData['eval']['dcaPicker']) {
$ppId = 'pp_'. $objWidget->strId;
$ctrl = 'ctrl_' . $objWidget->strId;
$url = System::getContainer()->get('huh.utils.url')->getCurrentUrl(['skipParams' => true]);

$link = sprintf('<a href="%s/picker?context=link&amp;value=" title="" id="%s"><img src="system/themes/flexible/icons/pickpage.svg" width="16" height="16" alt="Seiten auswählen"></a>', $url, $ppId);
$script = sprintf('<script>$("%s").addEvent("click", function(e) {
e.preventDefault();
Backend.openModalSelector({
"id": "tl_listing",
"title": "Link-Adresse",
"url": this.href + "&value=" + document.getElementById("%s").value,
"callback": function(picker, value) {
$("%s").value = value.join(",");
}.bind(this)
});
});
</script>', $ppId, $ctrl, $ctrl);

$wizard .= $link . $script;
}

// rte
if (!empty($arrData['eval']['rte'])) {
list($file, $type) = explode('|', $arrData['eval']['rte'], 2);
Expand Down

0 comments on commit 769e3e8

Please sign in to comment.