Skip to content

Commit 70ce232

Browse files
committed
Update the documentation. Change from tagsSortable to isSortable
1 parent 04f9f64 commit 70ce232

4 files changed

Lines changed: 6 additions & 38 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Tags Bundle is an extension for the [Contao Open Source CMS](https://contao.org).
88

99
The extension provides the tagging functionality in Contao. Backend widget is powered up by the excellent
10-
UI widget [selectize.js](https://github.com/selectize/selectize.js) that allows to easily manage tags.
10+
UI widget [Tom Select](https://tom-select.js.org/) that allows to easily manage tags.
1111

1212
> **IMPORTANT NOTE:** This project is aimed at the developers and it does not provide tagging
1313
to any of standard Contao features by default!

docs/01-installation.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,9 @@
77
5. [Backend interface](05-backend.md)
88
6. [Insert tags](06-insert-tags.md)
99

10-
## Requirements
11-
12-
Minimum requirements:
13-
14-
- PHP 7.1
15-
- Contao 4.9
16-
- Haste 4.24
17-
1810
## Install using Composer
1911

20-
Execute the following command in your Contao 4.9 project folder:
12+
Execute the following command in your Contao 5.7 project folder:
2113

2214
$ composer require codefog/tags-bundle
2315

docs/02-config.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,29 +78,10 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['app_tags'] = [
7878
'tagsManager' => 'app',
7979
'tagsCreate' => false, # Do not create new tags
8080
'tagsSource' => 'tl_table.tags', # Set the source if you have multiple of them
81-
'tagsSortable' => true, # Make the tags sortable. Works only with the tag values saved directly in the field (see below).
81+
'isSortable' => true, # Make the tags sortable. Works only with the tag values saved directly in the field (see below).
8282
'tl_class' => 'clr',
8383
],
8484
# Save the tag values directly in the field and do not use the Haste-ManyToMany relation
8585
'sql' => ['type' => 'blob', 'notnull' => false],
8686
];
8787
```
88-
89-
## Overriding Selectize.js settings
90-
91-
In case you would like to override the [Selectize.js settings](https://github.com/selectize/selectize.js/blob/master/docs/usage.md)
92-
directly you can always do that by passing the `selectizeConfig` property of the widget configuration, as shown on example:
93-
94-
```php
95-
<script>
96-
$('#cfg-tags-<?= $this->id ?>').cfgTags(
97-
<?= json_encode($this->allTags) ?>,
98-
<?= json_encode($this->valueTags) ?>,
99-
$.extend(<?= json_encode($this->config) ?>, {
100-
selectizeConfig: {
101-
hideSelected: true
102-
}
103-
})
104-
);
105-
</script>
106-
```

src/Widget/TagsWidget.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ class TagsWidget extends Widget
3333
*/
3434
protected $strTemplate = 'be_widget';
3535

36-
/**
37-
* Tags manager.
38-
*
39-
* @var ManagerInterface
40-
*/
41-
protected $tagsManager;
36+
protected ManagerInterface $tagsManager;
4237

4338
#[\Override]
4439
public function addAttributes($arrAttributes = null): void
@@ -98,7 +93,7 @@ protected function generateConfig(): array
9893
'removeLabel' => $GLOBALS['TL_LANG']['MSC']['removeItem'],
9994
'noResultsLabel' => $GLOBALS['TL_LANG']['MSC']['noResults'],
10095
'allowCreate' => isset($this->tagsCreate) ? (bool) $this->tagsCreate : true,
101-
'sortable' => isset($this->tagsSortable) && (bool) $this->tagsSortable,
96+
'sortable' => (bool) $this->isSortable,
10297
'allTags' => $this->generateAllTags($this->getAllTags()),
10398
'valueTags' => $this->generateValueTags($this->getValueTags()),
10499
];
@@ -126,7 +121,7 @@ protected function getValueTags(): array
126121
$tags = $this->tagsManager->getFilteredTags($values, $this->tagsSource);
127122

128123
// Respect the tags order
129-
if ($this->tagsSortable && \count($tags) > 0) {
124+
if ($this->isSortable && \count($tags) > 0) {
130125
usort(
131126
$tags,
132127
static function (Tag $aTag, Tag $bTag) use ($values) {

0 commit comments

Comments
 (0)