diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml
index 67fe092..6147873 100644
--- a/.github/workflows/phpunit.yml
+++ b/.github/workflows/phpunit.yml
@@ -3,6 +3,8 @@ name: PHPUnit Plugin Tests
on: [push, pull_request]
jobs:
- lint:
+ phpunit:
name: Run PHPUnit test suites
uses: ColdTrick/.github/.github/workflows/phpunit.yml@master
+ with:
+ elgg_major_version: 6
diff --git a/README.md b/README.md
index 3445f15..f11646d 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
Widget Pack
===========
-![Elgg 5.1](https://img.shields.io/badge/Elgg-5.1-green.svg)
+![Elgg 6.0](https://img.shields.io/badge/Elgg-6.0-green.svg)
![Lint Checks](https://github.com/ColdTrick/widget_pack/actions/workflows/lint.yml/badge.svg?event=push)
[![Latest Stable Version](https://poser.pugx.org/coldtrick/widget_pack/v/stable.svg)](https://packagist.org/packages/coldtrick/widget_pack)
[![License](https://poser.pugx.org/coldtrick/widget_pack/license.svg)](https://packagist.org/packages/coldtrick/widget_pack)
diff --git a/classes/ColdTrick/WidgetPack/Bookmarks.php b/classes/ColdTrick/WidgetPack/Bookmarks.php
index 8b49968..083cdb8 100644
--- a/classes/ColdTrick/WidgetPack/Bookmarks.php
+++ b/classes/ColdTrick/WidgetPack/Bookmarks.php
@@ -12,13 +12,13 @@ class Bookmarks {
*
* @param \Elgg\Event $event 'view_vars', 'widgets/content_by_tag/display/[simple|slim]'
*
- * @return void|array
+ * @return null|array
*/
- public static function changeEntityURL(\Elgg\Event $event) {
+ public static function changeEntityURL(\Elgg\Event $event): ?array {
$entity = $event->getEntityParam();
if (!$entity instanceof \ElggBookmark) {
- return;
+ return null;
}
$return_value = $event->getValue();
diff --git a/classes/ColdTrick/WidgetPack/ContentByTag.php b/classes/ColdTrick/WidgetPack/ContentByTag.php
index 0a74a62..6de624a 100644
--- a/classes/ColdTrick/WidgetPack/ContentByTag.php
+++ b/classes/ColdTrick/WidgetPack/ContentByTag.php
@@ -12,7 +12,7 @@ class ContentByTag {
*
* @return array
*/
- public static function getSupportedContent() {
+ public static function getSupportedContent(): array {
$result = [
'blog' => 'blog',
'file' => 'file',
@@ -20,7 +20,6 @@ public static function getSupportedContent() {
'bookmarks' => 'bookmarks',
'thewire' => 'thewire',
'event_manager' => 'event',
- 'tasks' => 'task_top',
'discussions' => 'discussion',
'poll' => 'poll',
'questions' => 'question',
@@ -35,6 +34,6 @@ public static function getSupportedContent() {
unset($result[$plugin]);
}
- return elgg_trigger_event_results('supported_content', 'widgets:content_by_tag', $result, $result);
+ return (array) elgg_trigger_event_results('supported_content', 'widgets:content_by_tag', $result, $result);
}
}
diff --git a/classes/ColdTrick/WidgetPack/Cron.php b/classes/ColdTrick/WidgetPack/Cron.php
index 58e45c3..5804948 100644
--- a/classes/ColdTrick/WidgetPack/Cron.php
+++ b/classes/ColdTrick/WidgetPack/Cron.php
@@ -14,7 +14,7 @@ class Cron {
*
* @return void
*/
- public static function fetchRssServerWidgets(\Elgg\Event $event) {
+ public static function fetchRssServerWidgets(\Elgg\Event $event): void {
if (elgg_get_plugin_setting('rss_cron', 'widget_pack') !== 'yes') {
return;
diff --git a/classes/ColdTrick/WidgetPack/Widgets.php b/classes/ColdTrick/WidgetPack/Widgets.php
index d4a9bae..5b69516 100644
--- a/classes/ColdTrick/WidgetPack/Widgets.php
+++ b/classes/ColdTrick/WidgetPack/Widgets.php
@@ -16,7 +16,7 @@ class Widgets {
*
* @param \Elgg\Event $event 'cacheable_handlers', 'widget_manager'
*
- * @return bool
+ * @return array
*/
public static function getCacheableWidgets(\Elgg\Event $event) {
$return_value = $event->getValue();
@@ -38,7 +38,7 @@ public static function getCacheableWidgets(\Elgg\Event $event) {
*
* @return void
*/
- public static function disableFreeHTMLInputFilter(\Elgg\Event $event) {
+ public static function disableFreeHTMLInputFilter(\Elgg\Event $event): void {
if (!elgg_is_admin_logged_in()) {
return;
}
@@ -67,15 +67,15 @@ public static function disableFreeHTMLInputFilter(\Elgg\Event $event) {
*
* @param \Elgg\Event $event 'format', 'friendly:time'
*
- * @return string
+ * @return null|string
*/
- public static function rssFriendlyTime(\Elgg\Event $event) {
+ public static function rssFriendlyTime(\Elgg\Event $event): ?string {
if (empty($event->getParam('time'))) {
- return;
+ return null;
}
if (!elgg_in_context('rss_date')) {
- return;
+ return null;
}
$date_info = getdate($event->getParam('time'));
@@ -94,19 +94,19 @@ public static function rssFriendlyTime(\Elgg\Event $event) {
*
* @param \Elgg\Event $event 'entity:url', 'object'
*
- * @return string
+ * @return null|string
*/
- public static function getTitleURLs(\Elgg\Event $event) {
+ public static function getTitleURLs(\Elgg\Event $event): ?string {
$return = $event->getValue();
if ($return) {
// someone else provided already a result
- return;
+ return null;
}
$widget = $event->getEntityParam();
if (!$widget instanceof \ElggWidget) {
// not a widget
- return;
+ return null;
}
switch ($widget->handler) {
@@ -132,6 +132,8 @@ public static function getTitleURLs(\Elgg\Event $event) {
}
break;
}
+
+ return null;
}
/**
@@ -141,14 +143,13 @@ public static function getTitleURLs(\Elgg\Event $event) {
*
* @return void
*/
- public static function twitterSearchGetWidgetID(\Elgg\Event $event) {
+ public static function twitterSearchGetWidgetID(\Elgg\Event $event): void {
$widget = get_entity((int) get_input('guid'));
if (!$widget instanceof \ElggWidget || $widget->handler !== 'twitter_search') {
return;
}
-
- // get embed code
+
$embed_code = get_input('embed_code', [], false); // do not strip code
if (empty($embed_code)) {
return;
@@ -181,11 +182,11 @@ public static function twitterSearchGetWidgetID(\Elgg\Event $event) {
*
* @param \Elgg\Event $event 'search:fields', 'user'
*
- * @return array
+ * @return null|array
*/
- public static function userSearchByEmail(\Elgg\Event $event) {
+ public static function userSearchByEmail(\Elgg\Event $event): ?array {
if ($event->getParam('widget') !== 'user_search') {
- return;
+ return null;
}
$value = (array) $event->getValue();
@@ -208,7 +209,7 @@ public static function userSearchByEmail(\Elgg\Event $event) {
*
* @return void
*/
- public static function rssServerInvalidateCache(\Elgg\Event $event) {
+ public static function rssServerInvalidateCache(\Elgg\Event $event): void {
$widget = $event->getObject();
if (!$widget instanceof \ElggWidget || $widget->handler !== 'rss_server') {
@@ -223,11 +224,11 @@ public static function rssServerInvalidateCache(\Elgg\Event $event) {
*
* @param \Elgg\Event $event 'entity:{$type}:sizes', 'object'
*
- * @return array
+ * @return null|array
*/
- public static function getSlideshowIconSizes(\Elgg\Event $event) {
+ public static function getSlideshowIconSizes(\Elgg\Event $event): ?array {
if (!preg_match('/^entity:slider_image_[\d]+:sizes$/', $event->getName())) {
- return;
+ return null;
}
$result = $event->getValue();
@@ -256,22 +257,22 @@ public static function getSlideshowIconSizes(\Elgg\Event $event) {
*
* @param \Elgg\Event $event 'response', 'action:widgets/save'
*
- * @return void|OkResponse
+ * @return null|OkResponse
*/
- public static function saveSlideshowConfig(\Elgg\Event $event) {
+ public static function saveSlideshowConfig(\Elgg\Event $event): ?OkResponse {
$result = $event->getValue();
if ($result instanceof ErrorResponse) {
- return;
+ return null;
}
$widget = get_entity((int) get_input('guid'));
if (!$widget instanceof \ElggWidget) {
- return;
+ return null;
}
if ($widget->handler !== 'image_slideshow') {
- return;
+ return null;
}
$old_config = $widget->slides_config ?: [];
diff --git a/composer.json b/composer.json
index 54b5f90..7715b53 100644
--- a/composer.json
+++ b/composer.json
@@ -13,6 +13,6 @@
"simplepie/simplepie": "~1.8.0"
},
"conflict": {
- "elgg/elgg": "<5.1"
+ "elgg/elgg": "<6.0"
}
}
diff --git a/composer.lock b/composer.lock
index 29f864d..9a1bb86 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "763989d8770da48182e53335e44be652",
+ "content-hash": "fa6864587e24e40388314facf1bd4e96",
"packages": [
{
"name": "simplepie/simplepie",
@@ -91,5 +91,5 @@
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
- "plugin-api-version": "2.3.0"
+ "plugin-api-version": "2.6.0"
}
diff --git a/views/default/widgets/content_by_tag/content.php b/views/default/widgets/content_by_tag/content.php
index 4767003..cbe35c2 100644
--- a/views/default/widgets/content_by_tag/content.php
+++ b/views/default/widgets/content_by_tag/content.php
@@ -62,7 +62,7 @@
return $qb->compare("{$joined_alias}.entity_guid", '=', "{$main_alias}.guid");
};
- $options['joins'][] = new JoinClause(QueryBuilder::TABLE_METADATA, $alias, $on);
+ $options['joins'][] = new JoinClause(\Elgg\Database\MetadataTable::TABLE_NAME, $alias, $on);
$options['wheres'][] = function(QueryBuilder $qb) use ($alias, $value) {
$md = new MetadataWhereClause();
diff --git a/views/default/widgets/content_by_tag/edit.js b/views/default/widgets/content_by_tag/edit.js
deleted file mode 100644
index 57ccce9..0000000
--- a/views/default/widgets/content_by_tag/edit.js
+++ /dev/null
@@ -1,13 +0,0 @@
-define(['jquery'], function ($) {
-
- $(document).on('change', '.elgg-form-widgets-save-content-by-tag [name="params[display_option]"]', function() {
- var $edit_form = $(this).parents('.elgg-form-widgets-save-content-by-tag');
- $edit_form.find('.widgets-content-by-tag-display-options > div').hide();
- $edit_form.find('.widgets-content-by-tag-display-options-' + $(this).val()).show();
- });
-
- init = function() {
- $('.elgg-form-widgets-save-content-by-tag [name="params[display_option]"]').change();
- $('.elgg-form-widgets-save-content-by-tag .elgg-user-picker').addClass('ui-front');
- };
-});
diff --git a/views/default/widgets/content_by_tag/edit.mjs b/views/default/widgets/content_by_tag/edit.mjs
new file mode 100644
index 0000000..b5c8a5f
--- /dev/null
+++ b/views/default/widgets/content_by_tag/edit.mjs
@@ -0,0 +1,7 @@
+import 'jquery';
+
+$(document).on('change', '.elgg-form-widgets-save-content-by-tag [name="params[display_option]"]', function() {
+ var $edit_form = $(this).parents('.elgg-form-widgets-save-content-by-tag');
+ $edit_form.find('.widgets-content-by-tag-display-options > div').hide();
+ $edit_form.find('.widgets-content-by-tag-display-options-' + $(this).val()).show();
+});
diff --git a/views/default/widgets/content_by_tag/edit.php b/views/default/widgets/content_by_tag/edit.php
index 71d8cee..e422214 100644
--- a/views/default/widgets/content_by_tag/edit.php
+++ b/views/default/widgets/content_by_tag/edit.php
@@ -17,6 +17,8 @@
$content_type = $keys[0];
}
+elgg_import_esm('widgets/content_by_tag/edit');
+
echo elgg_view_field([
'#type' => 'userpicker',
'#label' => elgg_echo('widgets:content_by_tag:owner_guids'),
@@ -36,12 +38,14 @@
'value' => 'yes',
'switch' => true,
]);
-} elseif (elgg_view_exists('input/grouppicker')) {
- $container_guids = elgg_echo('widgets:content_by_tag:container_guids') . '
';
- $container_guids .= elgg_view('input/hidden', ['name' => 'params[container_guids]', 'value' => 0]);
- $container_guids .= elgg_view('input/grouppicker', ['name' => 'params[container_guids]', 'values' => $widget->container_guids]);
- $container_guids .= elgg_format_element('div', ['class' => 'elgg-subtext'], elgg_echo('widgets:content_by_tag:container_guids:description'));
- echo elgg_format_element('div', [], $container_guids);
+} else {
+ echo elgg_view_field([
+ '#type' => 'grouppicker',
+ '#label' => elgg_echo('widgets:content_by_tag:container_guids'),
+ '#help' => elgg_echo('widgets:content_by_tag:container_guids:description'),
+ 'name' => 'params[container_guids]',
+ 'values' => $widget->container_guids,
+ ]);
}
echo elgg_view('object/widget/edit/num_display', [
@@ -106,34 +110,40 @@
],
]);
-$display_options = '';
-
-$content = elgg_view_field([
- '#type' => 'checkbox',
- '#label' => elgg_echo('widgets:content_by_tag:show_avatar'),
- 'name' => 'params[show_avatar]',
- 'checked' => $widget->show_avatar !== 'no',
- 'default' => 'no',
- 'value' => 'yes',
- 'switch' => true,
-]);
-
-$display_options .= elgg_format_element('div', ['class' => 'widgets-content-by-tag-display-options-simple'], $content);
-
-$content = elgg_view_field([
- '#type' => 'checkbox',
- '#label' => elgg_echo('widgets:content_by_tag:show_timestamp'),
- 'name' => 'params[show_timestamp]',
- 'checked' => $widget->show_timestamp !== 'no',
- 'default' => 'no',
- 'value' => 'yes',
- 'switch' => true,
+echo elgg_view_field([
+ '#type' => 'fieldset',
+ 'class' => 'widgets-content-by-tag-display-options',
+ 'fields' => [
+ [
+ '#type' => 'checkbox',
+ '#label' => elgg_echo('widgets:content_by_tag:show_avatar'),
+ '#class' => [
+ 'widgets-content-by-tag-display-options-simple',
+ $widget->display_option !== 'simple' ? 'hidden' : null,
+ ],
+ 'name' => 'params[show_avatar]',
+ 'checked' => $widget->show_avatar !== 'no',
+ 'default' => 'no',
+ 'value' => 'yes',
+ 'switch' => true,
+ ],
+ [
+ '#type' => 'checkbox',
+ '#label' => elgg_echo('widgets:content_by_tag:show_timestamp'),
+ '#class' => [
+ 'widgets-content-by-tag-display-options-simple',
+ 'widgets-content-by-tag-display-options-slim',
+ !in_array($widget->display_option, ['simple', 'slim']) ? 'hidden' : null,
+ ],
+ 'name' => 'params[show_timestamp]',
+ 'checked' => $widget->show_timestamp !== 'no',
+ 'default' => 'no',
+ 'value' => 'yes',
+ 'switch' => true,
+ ],
+ ],
]);
-$display_options .= elgg_format_element('div', ['class' => 'widgets-content-by-tag-display-options-simple widgets-content-by-tag-display-options-slim'], $content);
-
-echo elgg_format_element('div', ['class' => 'widgets-content-by-tag-display-options'], $display_options);
-
echo elgg_view_field([
'#type' => 'select',
'#label' => elgg_echo('widgets:content_by_tag:order_by'),
@@ -144,5 +154,3 @@
'alpha' => elgg_echo('widgets:content_by_tag:order_by:alpha'),
],
]);
-
-echo elgg_format_element('script', [], 'require(["widgets/content_by_tag/edit"], function() { init(); })');
diff --git a/views/default/widgets/entity_statistics/content.php b/views/default/widgets/entity_statistics/content.php
index ef554b2..e4ac77a 100644
--- a/views/default/widgets/entity_statistics/content.php
+++ b/views/default/widgets/entity_statistics/content.php
@@ -18,34 +18,16 @@
if (!empty($selected_entities) && !in_array($key, $selected_entities)) {
continue;
}
-
- if ($a == '__base__') {
- $a = elgg_echo("item:{$k}");
- if ($k == 'user') {
- $count = elgg_count_entities([
- 'type' => 'user',
- 'wheres' => [
- function(QueryBuilder $qb, $main_alias) {
- return $qb->compare("{$main_alias}.last_action", '>=', Values::normalizeTimestamp('-10 minutes'), ELGG_VALUE_TIMESTAMP);
- }
- ],
- ]);
-
- $b .= ' (' . elgg_echo('admin:users:online') . ' ' . $count . ')';
- }
+
+ if (elgg_language_key_exists("collection:{$k}:{$a}")) {
+ $text = elgg_echo("collection:{$k}:{$a}");
+ } elseif (elgg_language_key_exists("item:{$k}:{$a}")) {
+ $text = elgg_echo("item:{$k}:{$a}");
} else {
- if (empty($a)) {
- $a = elgg_echo("item:{$k}");
- } else {
- $a = elgg_echo("item:{$k}:{$a}");
- }
-
- if (empty($a)) {
- $a = "{$k} {$a}";
- }
+ $text = "{$k} {$a}";
}
- $result .= "
{$a}: | {$b} |
";
+ $result .= "{$text}: | {$b} |
";
}
}
diff --git a/views/default/widgets/entity_statistics/edit.php b/views/default/widgets/entity_statistics/edit.php
index 943d185..d6984c2 100644
--- a/views/default/widgets/entity_statistics/edit.php
+++ b/views/default/widgets/entity_statistics/edit.php
@@ -10,24 +10,15 @@
foreach ($entry as $a => $b) {
$key = $k . '|' . $a;
- if ($a == '__base__') {
- $a = elgg_echo("item:{$k}");
- if (empty($a)) {
- $a = $k;
- }
+ if (elgg_language_key_exists("collection:{$k}:{$a}")) {
+ $text = elgg_echo("collection:{$k}:{$a}");
+ } elseif (elgg_language_key_exists("item:{$k}:{$a}")) {
+ $text = elgg_echo("item:{$k}:{$a}");
} else {
- if (empty($a)) {
- $a = elgg_echo("item:{$k}");
- } else {
- $a = elgg_echo("item:{$k}:{$a}");
- }
-
- if (empty($a)) {
- $a = "$k $a";
- }
+ $text = "{$k} {$a}";
}
- $options_values[$key] = $a;
+ $options_values[$key] = $text;
}
}
diff --git a/views/default/widgets/image_slideshow/content.js b/views/default/widgets/image_slideshow/content.js
deleted file mode 100644
index 548369a..0000000
--- a/views/default/widgets/image_slideshow/content.js
+++ /dev/null
@@ -1,69 +0,0 @@
-define(['jquery'], function ($) {
-
- function SlideShow(selector) {
- var SlideShow = this;
- this.$container = $(selector);
- this.totalSlides = this.$container.find('> .slide-fade').length;
- this.currentSlide = 1;
- this.slideTimeout = 5000;
-
- this.$container.on('click', '.slide-next', function() {
- SlideShow.moveNext();
- });
- this.$container.on('click', '.slide-previous', function() {
- SlideShow.movePrevious();
- });
- this.$container.on('click', '.slide-startstop', function() {
- SlideShow.startStop();
- });
-
- if (this.$container.hasClass('slideshow-autoplay')) {
- this.timeoutId = setTimeout(function() {
- SlideShow.moveNext();
- }, this.slideTimeout);
- }
- }
-
- SlideShow.prototype = {
- showSlide: function(index) {
- clearTimeout(this.timeoutId);
-
- this.$container.find('> .slide-fade:not(.hidden)').addClass('hidden');
-
- this.$container.find('> .slide-fade').eq(index - 1).removeClass('hidden');
-
- if (this.$container.hasClass('slideshow-autoplay')) {
- this.timeoutId = setTimeout(this.moveNext.bind(this), this.slideTimeout);
- }
- },
- moveNext: function() {
- if (this.currentSlide >= this.totalSlides) {
- this.currentSlide = 1;
- } else {
- this.currentSlide++;
- }
-
- this.showSlide(this.currentSlide);
- },
- movePrevious: function() {
- if (this.currentSlide <= 1) {
- this.currentSlide = this.totalSlides;
- } else {
- this.currentSlide--;
- }
-
- this.showSlide(this.currentSlide);
- },
- startStop: function() {
- this.$container.toggleClass('slideshow-autoplay');
-
- if (this.$container.hasClass('slideshow-autoplay')) {
- this.timeoutId = setTimeout(this.moveNext.bind(this), this.slideTimeout);
- } else {
- clearTimeout(this.timeoutId);
- }
- }
- };
-
- return SlideShow;
-});
diff --git a/views/default/widgets/image_slideshow/content.mjs b/views/default/widgets/image_slideshow/content.mjs
new file mode 100644
index 0000000..df943bb
--- /dev/null
+++ b/views/default/widgets/image_slideshow/content.mjs
@@ -0,0 +1,68 @@
+import 'jquery';
+
+function SlideShow(selector) {
+ var SlideShow = this;
+ this.$container = $(selector);
+ this.totalSlides = this.$container.find('> .slide-fade').length;
+ this.currentSlide = 1;
+ this.slideTimeout = 5000;
+
+ this.$container.on('click', '.slide-next', function() {
+ SlideShow.moveNext();
+ });
+ this.$container.on('click', '.slide-previous', function() {
+ SlideShow.movePrevious();
+ });
+ this.$container.on('click', '.slide-startstop', function() {
+ SlideShow.startStop();
+ });
+
+ if (this.$container.hasClass('slideshow-autoplay')) {
+ this.timeoutId = setTimeout(function() {
+ SlideShow.moveNext();
+ }, this.slideTimeout);
+ }
+}
+
+SlideShow.prototype = {
+ showSlide: function(index) {
+ clearTimeout(this.timeoutId);
+
+ this.$container.find('> .slide-fade:not(.hidden)').addClass('hidden');
+
+ this.$container.find('> .slide-fade').eq(index - 1).removeClass('hidden');
+
+ if (this.$container.hasClass('slideshow-autoplay')) {
+ this.timeoutId = setTimeout(this.moveNext.bind(this), this.slideTimeout);
+ }
+ },
+ moveNext: function() {
+ if (this.currentSlide >= this.totalSlides) {
+ this.currentSlide = 1;
+ } else {
+ this.currentSlide++;
+ }
+
+ this.showSlide(this.currentSlide);
+ },
+ movePrevious: function() {
+ if (this.currentSlide <= 1) {
+ this.currentSlide = this.totalSlides;
+ } else {
+ this.currentSlide--;
+ }
+
+ this.showSlide(this.currentSlide);
+ },
+ startStop: function() {
+ this.$container.toggleClass('slideshow-autoplay');
+
+ if (this.$container.hasClass('slideshow-autoplay')) {
+ this.timeoutId = setTimeout(this.moveNext.bind(this), this.slideTimeout);
+ } else {
+ clearTimeout(this.timeoutId);
+ }
+ }
+};
+
+export default SlideShow;
diff --git a/views/default/widgets/image_slideshow/content.php b/views/default/widgets/image_slideshow/content.php
index 544483e..2597bdc 100644
--- a/views/default/widgets/image_slideshow/content.php
+++ b/views/default/widgets/image_slideshow/content.php
@@ -63,8 +63,8 @@
echo elgg_format_element('div', ['id' => $id, 'class' => $container_class], $slides);
?>
-
diff --git a/views/default/widgets/image_slideshow/edit.js b/views/default/widgets/image_slideshow/edit.js
deleted file mode 100644
index abaa71f..0000000
--- a/views/default/widgets/image_slideshow/edit.js
+++ /dev/null
@@ -1,49 +0,0 @@
-define(['jquery', 'entity/edit/icon/crop'], function ($, Cropper) {
- $(document).on('click', '#slide-template-add', function() {
- $(this).closest('.elgg-tabs-content').find('.elgg-module-info:not("#slide-template") > .elgg-body').addClass('hidden');
-
- var $template = $('#slide-template');
- var $newslide = $template.clone().insertBefore($template);
-
- var $slide_index_input = $(this).closest('form').find('input[name="params[new_slide_index]"]');
- var new_index = parseInt($slide_index_input.val());
-
- $slide_index_input.val(new_index + 1);
-
- var new_slide_name = 'slider_image_' + new_index;
-
- $newslide.removeAttr('id').removeClass('hidden');
- $newslide.find('input[name="slider_image_template"').attr('name', new_slide_name);
- $newslide.find('input[name="slider_image_template_x1"').attr('name', new_slide_name + '_x1');
- $newslide.find('input[name="slider_image_template_x2"').attr('name', new_slide_name + '_x2');
- $newslide.find('input[name="slider_image_template_y1"').attr('name', new_slide_name + '_y1');
- $newslide.find('input[name="slider_image_template_y2"').attr('name', new_slide_name + '_y2');
-
- var cropper = new Cropper();
-
- cropper.init('input[type="file"][name="' + new_slide_name + '"]');
- });
-
- $(document).on('click', '.elgg-menu-slide-menu .elgg-menu-item-edit', function() {
- $(this).closest('.elgg-module-info').find('> .elgg-body').toggleClass('hidden');
- });
-
- $(document).on('click', '.elgg-menu-slide-menu .elgg-menu-item-delete', function() {
- $(this).closest('.elgg-module-info').remove();
- });
-
- $(document).on('change', '#slideshow-orientation', function(event) {
- var aspect_ratio = $(event.target).data($(event.target).val() + 'AspectRatio');
- $(this).closest('form').find('img[data-icon-cropper]').each(function() {
- var config = $(this).data('iconCropper');
- config.aspectRatio = aspect_ratio;
- config.initialAspectRatio = aspect_ratio;
-
- // update config of all (including the template)
- $(this).attr('data-icon-cropper', JSON.stringify(config));
-
- // update active croppers
- $(this).cropper('setAspectRatio', aspect_ratio);
- });
- });
-});
diff --git a/views/default/widgets/image_slideshow/edit.mjs b/views/default/widgets/image_slideshow/edit.mjs
new file mode 100644
index 0000000..e8a79e3
--- /dev/null
+++ b/views/default/widgets/image_slideshow/edit.mjs
@@ -0,0 +1,50 @@
+import 'jquery';
+import Cropper from 'entity/edit/icon/crop';
+
+$(document).on('click', '#slide-template-add', function() {
+ $(this).closest('.elgg-tabs-content').find('.elgg-module-info:not("#slide-template") > .elgg-body').addClass('hidden');
+
+ var $template = $('#slide-template');
+ var $newslide = $template.clone().insertBefore($template);
+
+ var $slide_index_input = $(this).closest('form').find('input[name="params[new_slide_index]"]');
+ var new_index = parseInt($slide_index_input.val());
+
+ $slide_index_input.val(new_index + 1);
+
+ var new_slide_name = 'slider_image_' + new_index;
+
+ $newslide.removeAttr('id').removeClass('hidden');
+ $newslide.find('input[name="slider_image_template"').attr('name', new_slide_name);
+ $newslide.find('input[name="slider_image_template_x1"').attr('name', new_slide_name + '_x1');
+ $newslide.find('input[name="slider_image_template_x2"').attr('name', new_slide_name + '_x2');
+ $newslide.find('input[name="slider_image_template_y1"').attr('name', new_slide_name + '_y1');
+ $newslide.find('input[name="slider_image_template_y2"').attr('name', new_slide_name + '_y2');
+
+ var cropper = new Cropper();
+
+ cropper.init('input[type="file"][name="' + new_slide_name + '"]');
+});
+
+$(document).on('click', '.elgg-menu-slide-menu .elgg-menu-item-edit', function() {
+ $(this).closest('.elgg-module-info').find('> .elgg-body').toggleClass('hidden');
+});
+
+$(document).on('click', '.elgg-menu-slide-menu .elgg-menu-item-delete', function() {
+ $(this).closest('.elgg-module-info').remove();
+});
+
+$(document).on('change', '#slideshow-orientation', function(event) {
+ var aspect_ratio = $(event.target).data($(event.target).val() + 'AspectRatio');
+ $(this).closest('form').find('img[data-icon-cropper]').each(function() {
+ var config = $(this).data('iconCropper');
+ config.aspectRatio = aspect_ratio;
+ config.initialAspectRatio = aspect_ratio;
+
+ // update config of all (including the template)
+ $(this).attr('data-icon-cropper', JSON.stringify(config));
+
+ // update active croppers
+ $(this).cropper('setAspectRatio', aspect_ratio);
+ });
+});
diff --git a/views/default/widgets/image_slideshow/edit.php b/views/default/widgets/image_slideshow/edit.php
index 52931a9..cb386f8 100644
--- a/views/default/widgets/image_slideshow/edit.php
+++ b/views/default/widgets/image_slideshow/edit.php
@@ -1,6 +1,6 @@
orientation ?: 'landscape';
@@ -132,5 +132,14 @@
'value' => $widget->new_slide_index ?: 2,
]);
-$init_js = '$(".elgg-form-widgets-save-image-slideshow .elgg-content").sortable({ items: ".elgg-module-info", handle: ".elgg-head > h3 > .elgg-icon-arrows-alt", containment: "parent" });';
-echo elgg_format_element('script', [], 'require(["jquery", "jquery-ui/widgets/sortable"], function($) { ' . $init_js . ' });');
+?>
+
diff --git a/views/default/widgets/index_activity/content.php b/views/default/widgets/index_activity/content.php
index bc4710f..371d1cb 100644
--- a/views/default/widgets/index_activity/content.php
+++ b/views/default/widgets/index_activity/content.php
@@ -4,11 +4,6 @@
$count = (int) $widget->activity_count ?: 10;
$activity_content = (array) $widget->activity_content;
-if ($activity_content === 'all') {
- unset($activity_content);
-}
-
-$activity_content = (array) $activity_content;
$river_options = [
'pagination' => false,
diff --git a/views/default/widgets/index_activity/edit.php b/views/default/widgets/index_activity/edit.php
index f26a068..42bbee1 100644
--- a/views/default/widgets/index_activity/edit.php
+++ b/views/default/widgets/index_activity/edit.php
@@ -6,12 +6,9 @@
$registered_entities = elgg_entity_types_with_capability('searchable');
-if (!empty($registered_entities)) {
- foreach ($registered_entities as $type => $ar) {
- foreach ($ar as $subtype) {
- $keyname = 'item:' . $type . ':' . $subtype;
- $contents[elgg_echo($keyname)] = "{$type},{$subtype}";
- }
+foreach ($registered_entities as $type => $subtypes) {
+ foreach ($subtypes as $subtype) {
+ $contents[elgg_echo("item:{$type}:{$subtype}")] = "{$type},{$subtype}";
}
}
diff --git a/views/default/widgets/index_login/content.php b/views/default/widgets/index_login/content.php
index 6e58bf0..49189d0 100644
--- a/views/default/widgets/index_login/content.php
+++ b/views/default/widgets/index_login/content.php
@@ -5,6 +5,7 @@
elgg_get_logged_in_user_entity()->name,
elgg_get_site_entity()->name,
]);
+
return;
}
diff --git a/views/default/widgets/index_members/content.php b/views/default/widgets/index_members/content.php
index e6f5f7e..74b57d1 100644
--- a/views/default/widgets/index_members/content.php
+++ b/views/default/widgets/index_members/content.php
@@ -11,5 +11,5 @@
'gallery_class' => 'elgg-gallery-users',
'size' => 'small',
'no_results' => elgg_echo('widgets:index_members:no_result'),
- 'metadata_name' => $widget->user_icon === 'yes' ? 'icontime' : null,
+ 'metadata_name' => $widget->user_icon === 'yes' ? 'icon_coords' : null,
]);
diff --git a/views/default/widgets/index_members_online/content.php b/views/default/widgets/index_members_online/content.php
index e6e50fa..74701bc 100644
--- a/views/default/widgets/index_members_online/content.php
+++ b/views/default/widgets/index_members_online/content.php
@@ -18,5 +18,5 @@
'gallery_class' => 'elgg-gallery-users',
'size' => 'small',
'no_results' => elgg_echo('widgets:index_members_online:no_result'),
- 'metadata_name' => $widget->user_icon === 'yes' ? 'icontime' : null,
+ 'metadata_name' => $widget->user_icon === 'yes' ? 'icon_coords' : null,
]);
diff --git a/views/default/widgets/rss_server/content.php b/views/default/widgets/rss_server/content.php
index 06d8e06..fd6f73c 100644
--- a/views/default/widgets/rss_server/content.php
+++ b/views/default/widgets/rss_server/content.php
@@ -145,7 +145,7 @@
}
}
-// proccess items
+// process items
$lis = [];
foreach ($feed_data['items'] as $index => $item) {
$title_text = elgg_extract('title', $item);
diff --git a/views/default/widgets/start_discussion/quick_start.js b/views/default/widgets/start_discussion/quick_start.js
deleted file mode 100644
index 1e4070f..0000000
--- a/views/default/widgets/start_discussion/quick_start.js
+++ /dev/null
@@ -1,18 +0,0 @@
-define(['jquery'], function ($) {
-
- $(document).on('change', '.elgg-form-start-discussion-quick-start select[name="container_guid"]', function () {
- var $form = $(this).closest('form');
- var selected_group = $(this).val();
-
- var $options = $form.find('select[name="access_id"]').find('option');
- $options.prop('selected', false);
-
- if (selected_group !== '') {
- $options.each(function (index, elem) {
- if ($(elem).html() === selected_group) {
- $(elem).prop('selected', true);
- }
- });
- }
- });
-});
diff --git a/views/default/widgets/start_discussion/quick_start.mjs b/views/default/widgets/start_discussion/quick_start.mjs
new file mode 100644
index 0000000..a3dff43
--- /dev/null
+++ b/views/default/widgets/start_discussion/quick_start.mjs
@@ -0,0 +1,17 @@
+import 'jquery';
+
+$(document).on('change', '.elgg-form-start-discussion-quick-start select[name="container_guid"]', function () {
+ var $form = $(this).closest('form');
+ var selected_group = $(this).val();
+
+ var $options = $form.find('select[name="access_id"]').find('option');
+ $options.prop('selected', false);
+
+ if (selected_group !== '') {
+ $options.each(function (index, elem) {
+ if ($(elem).html() === selected_group) {
+ $(elem).prop('selected', true);
+ }
+ });
+ }
+});
diff --git a/views/default/widgets/start_discussion/quick_start.php b/views/default/widgets/start_discussion/quick_start.php
index ba4f92a..15acbe5 100644
--- a/views/default/widgets/start_discussion/quick_start.php
+++ b/views/default/widgets/start_discussion/quick_start.php
@@ -6,7 +6,7 @@
$wrapper_id = uniqid();
-elgg_require_js('widgets/start_discussion/quick_start');
+elgg_import_esm('widgets/start_discussion/quick_start');
// show a button to expend the form
echo elgg_view('output/url', [
diff --git a/views/default/widgets/user_search/content.js b/views/default/widgets/user_search/content.js
deleted file mode 100644
index b4c0791..0000000
--- a/views/default/widgets/user_search/content.js
+++ /dev/null
@@ -1,17 +0,0 @@
-define(['jquery', 'elgg/Ajax'], function ($, Ajax) {
- $(document).on('submit', '.widget-user-search-form', function(){
- var ajax = new Ajax();
-
- var $form = $(this);
-
- ajax.view('widgets/user_search/content', {
- method: 'POST',
- data: ajax.objectify($form),
- success: function(result) {
- $form.parent().html(result);
- }
- });
-
- return false;
- });
-});
diff --git a/views/default/widgets/user_search/content.mjs b/views/default/widgets/user_search/content.mjs
new file mode 100644
index 0000000..d6d50e3
--- /dev/null
+++ b/views/default/widgets/user_search/content.mjs
@@ -0,0 +1,18 @@
+import 'jquery';
+import Ajax from 'elgg/Ajax';
+
+$(document).on('submit', '.widget-user-search-form', function(){
+ var ajax = new Ajax();
+
+ var $form = $(this);
+
+ ajax.view('widgets/user_search/content', {
+ method: 'POST',
+ data: ajax.objectify($form),
+ success: function(result) {
+ $form.parent().html(result);
+ }
+ });
+
+ return false;
+});
diff --git a/views/default/widgets/user_search/content.php b/views/default/widgets/user_search/content.php
index 6589203..58e5b5b 100644
--- a/views/default/widgets/user_search/content.php
+++ b/views/default/widgets/user_search/content.php
@@ -9,7 +9,7 @@
}
}
-elgg_require_js('widgets/user_search/content');
+elgg_import_esm('widgets/user_search/content');
$q = get_input('q');