Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]

## 0.8.0 (May 17, 2026)

### Added
- **Geolocation** field on the content plugin and site module — dropdown (Widget Default / On / Off) to enable or disable location-based search (the Near Me button and typed-location search). On the content plugin, can be overridden per shortcode via `geolocation="true"` / `geolocation="false"` (already supported). `widget_config` JSON `geolocation` key still wins over the admin setting.

## 0.7.0 (May 12, 2026)

### Added
Expand Down
6 changes: 6 additions & 0 deletions packages/module/language/en-GB/mod_crumb.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ MOD_CRUMB_FIELD_CSS_TEMPLATE_NONE="— None —"
MOD_CRUMB_FIELD_CSS_TEMPLATE_FW="Full Width"
MOD_CRUMB_FIELD_CSS_TEMPLATE_FW_FORCE="Full Width (Force Viewport)"

MOD_CRUMB_FIELD_GEOLOCATION_LABEL="Geolocation"
MOD_CRUMB_FIELD_GEOLOCATION_DESC="Optional. Enable or disable location-based search (the Near Me button and typed-location search). Widget defaults to off for most servers, and on when the BMLT Server URL points at the unconstrained aggregator with no service body set. Ignored if geolocation is already set in Widget Configuration JSON."
MOD_CRUMB_FIELD_GEOLOCATION_DEFAULT="— Widget Default —"
MOD_CRUMB_FIELD_GEOLOCATION_ON="On"
MOD_CRUMB_FIELD_GEOLOCATION_OFF="Off"

MOD_CRUMB_FIELD_GEOLOCATION_RADIUS_LABEL="Geolocation Radius"
MOD_CRUMB_FIELD_GEOLOCATION_RADIUS_DESC="Optional. Geolocation search radius. Positive integer = fixed radius in miles (or km per server settings). Negative integer = BMLT auto-radius (e.g. -50 finds ~50 nearby meetings). Leave empty to use the widget default (-50). Ignored if geolocationRadius is already set in Widget Configuration JSON."

Expand Down
13 changes: 12 additions & 1 deletion packages/module/mod_crumb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GPL v2 or later</license>
<authorEmail>bmlt-enabled@googlegroups.com</authorEmail>
<authorUrl>https://github.com/bmlt-enabled/crumb-joomla</authorUrl>
<version>0.7.0</version>
<version>0.8.0</version>
<description>MOD_CRUMB_XML_DESCRIPTION</description>
<namespace path="src">BmltEnabled\Module\Crumb\Site</namespace>

Expand Down Expand Up @@ -96,6 +96,17 @@
<option value="full_width">MOD_CRUMB_FIELD_CSS_TEMPLATE_FW</option>
<option value="full_width_force">MOD_CRUMB_FIELD_CSS_TEMPLATE_FW_FORCE</option>
</field>
<field
name="geolocation"
type="list"
label="MOD_CRUMB_FIELD_GEOLOCATION_LABEL"
description="MOD_CRUMB_FIELD_GEOLOCATION_DESC"
default=""
>
<option value="">MOD_CRUMB_FIELD_GEOLOCATION_DEFAULT</option>
<option value="1">MOD_CRUMB_FIELD_GEOLOCATION_ON</option>
<option value="0">MOD_CRUMB_FIELD_GEOLOCATION_OFF</option>
</field>
<field
name="geolocation_radius"
type="text"
Expand Down
7 changes: 7 additions & 0 deletions packages/module/src/Helper/CrumbHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function getSettings(Registry $params): array
'language' => (string) $params->get('language', ''),
'css_template' => (string) $params->get('css_template', ''),
'base_path' => (string) $params->get('base_path', ''),
'geolocation' => (string) $params->get('geolocation', ''),
'geolocation_radius' => (string) $params->get('geolocation_radius', ''),
'update_url' => (string) $params->get('update_url', ''),
'columns' => (string) $params->get('columns', ''),
Expand Down Expand Up @@ -113,6 +114,12 @@ public function render(array $settings): string
}
}

// Merge geolocation admin setting if not already set in widget_config JSON.
$geoSetting = (string) ($settings['geolocation'] ?? '');
if ($geoSetting !== '' && !isset($configArray['geolocation'])) {
$configArray['geolocation'] = ($geoSetting === '1');
}

// Merge geolocation_radius admin setting if not already set in widget_config JSON.
$geoRadiusSetting = (string) ($settings['geolocation_radius'] ?? '');
if ($geoRadiusSetting !== '' && !isset($configArray['geolocationRadius'])) {
Expand Down
13 changes: 12 additions & 1 deletion packages/plugin/crumb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GPL v2 or later</license>
<authorEmail>bmlt-enabled@googlegroups.com</authorEmail>
<authorUrl>https://github.com/bmlt-enabled/crumb-joomla</authorUrl>
<version>0.7.0</version>
<version>0.8.0</version>
<description>PLG_CONTENT_CRUMB_XML_DESCRIPTION</description>
<namespace path="src">BmltEnabled\Plugin\Content\Crumb</namespace>

Expand Down Expand Up @@ -95,6 +95,17 @@
<option value="full_width">PLG_CONTENT_CRUMB_FIELD_CSS_TEMPLATE_FW</option>
<option value="full_width_force">PLG_CONTENT_CRUMB_FIELD_CSS_TEMPLATE_FW_FORCE</option>
</field>
<field
name="geolocation"
type="list"
label="PLG_CONTENT_CRUMB_FIELD_GEOLOCATION_LABEL"
description="PLG_CONTENT_CRUMB_FIELD_GEOLOCATION_DESC"
default=""
>
<option value="">PLG_CONTENT_CRUMB_FIELD_GEOLOCATION_DEFAULT</option>
<option value="1">PLG_CONTENT_CRUMB_FIELD_GEOLOCATION_ON</option>
<option value="0">PLG_CONTENT_CRUMB_FIELD_GEOLOCATION_OFF</option>
</field>
<field
name="geolocation_radius"
type="text"
Expand Down
6 changes: 6 additions & 0 deletions packages/plugin/language/en-GB/plg_content_crumb.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ PLG_CONTENT_CRUMB_FIELD_CSS_TEMPLATE_NONE="— None —"
PLG_CONTENT_CRUMB_FIELD_CSS_TEMPLATE_FW="Full Width"
PLG_CONTENT_CRUMB_FIELD_CSS_TEMPLATE_FW_FORCE="Full Width (Force Viewport)"

PLG_CONTENT_CRUMB_FIELD_GEOLOCATION_LABEL="Geolocation"
PLG_CONTENT_CRUMB_FIELD_GEOLOCATION_DESC="Optional. Enable or disable location-based search (the Near Me button and typed-location search). Widget defaults to off for most servers, and on when the BMLT Server URL points at the unconstrained aggregator with no service body set. Can be overridden per shortcode via geolocation=&quot;true&quot; or geolocation=&quot;false&quot;. Ignored if geolocation is already set in Widget Configuration JSON."
PLG_CONTENT_CRUMB_FIELD_GEOLOCATION_DEFAULT="— Widget Default —"
PLG_CONTENT_CRUMB_FIELD_GEOLOCATION_ON="On"
PLG_CONTENT_CRUMB_FIELD_GEOLOCATION_OFF="Off"

PLG_CONTENT_CRUMB_FIELD_GEOLOCATION_RADIUS_LABEL="Geolocation Radius"
PLG_CONTENT_CRUMB_FIELD_GEOLOCATION_RADIUS_DESC="Optional. Geolocation search radius. Positive integer = fixed radius in miles (or km per server settings). Negative integer = BMLT auto-radius (e.g. -50 finds ~50 nearby meetings). Leave empty to use the widget default (-50). Can be overridden per shortcode via geolocation_radius=&quot;-50&quot;. Ignored if geolocationRadius is already set in Widget Configuration JSON."

Expand Down
1 change: 1 addition & 0 deletions packages/plugin/src/Extension/Crumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function onContentPrepare(string $context, &$article = null, &$params = n
'language' => (string) $this->params->get('language', ''),
'css_template' => (string) $this->params->get('css_template', ''),
'base_path' => (string) $this->params->get('base_path', ''),
'geolocation' => (string) $this->params->get('geolocation', ''),
'geolocation_radius' => (string) $this->params->get('geolocation_radius', ''),
'update_url' => (string) $this->params->get('update_url', ''),
'columns' => (string) $this->params->get('columns', ''),
Expand Down
8 changes: 8 additions & 0 deletions packages/plugin/src/Helper/CrumbRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ public static function render(array $settings, array $overrides = []): string
}
}

// Merge geolocation admin setting if not already set in widget_config JSON.
// Per-shortcode geolocation arg is handled above via data-geolocation, which the
// widget reads after CrumbWidgetConfig — so that override still wins.
$geoSetting = (string) ($settings['geolocation'] ?? '');
if ($geoSetting !== '' && !isset($configArray['geolocation'])) {
$configArray['geolocation'] = ($geoSetting === '1');
}

// Merge geolocation_radius admin setting if not already set in widget_config JSON.
$geoRadiusSetting = (string) ($settings['geolocation_radius'] ?? '');
if ($geoRadiusSetting !== '' && !isset($configArray['geolocationRadius'])) {
Expand Down
2 changes: 1 addition & 1 deletion pkg_crumb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<authorEmail>bmlt-enabled@googlegroups.com</authorEmail>
<authorUrl>https://github.com/bmlt-enabled/crumb-joomla</authorUrl>
<packagename>crumb</packagename>
<version>0.7.0</version>
<version>0.8.0</version>
<url>https://github.com/bmlt-enabled/crumb-joomla</url>
<packager>bmlt-enabled</packager>
<packagerurl>https://github.com/bmlt-enabled</packagerurl>
Expand Down
50 changes: 50 additions & 0 deletions tests/Unit/CrumbRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,56 @@ public function testEmptyGeolocationRadiusProducesNoConfigScript(): void
$this->assertStringNotContainsString('CrumbWidgetConfig', $output);
}

public function testGeolocationSettingOnMergesIntoConfig(): void
{
$output = CrumbRenderer::render([
'server' => 'https://x/main_server',
'geolocation' => '1',
]);
$this->assertStringContainsString('window.CrumbWidgetConfig', $output);
$this->assertStringContainsString('"geolocation":true', $output);
}

public function testGeolocationSettingOffMergesIntoConfig(): void
{
$output = CrumbRenderer::render([
'server' => 'https://x/main_server',
'geolocation' => '0',
]);
$this->assertStringContainsString('"geolocation":false', $output);
}

public function testEmptyGeolocationSettingProducesNoConfigScript(): void
{
$output = CrumbRenderer::render([
'server' => 'https://x/main_server',
'geolocation' => '',
]);
$this->assertStringNotContainsString('CrumbWidgetConfig', $output);
}

public function testWidgetConfigGeolocationTakesPrecedenceOverSetting(): void
{
$output = CrumbRenderer::render([
'server' => 'https://x/main_server',
'geolocation' => '0',
'widget_config' => '{"geolocation":true}',
]);
$this->assertStringContainsString('"geolocation":true', $output);
$this->assertStringNotContainsString('"geolocation":false', $output);
}

public function testShortcodeGeolocationOverrideEmitsDataAttribute(): void
{
// Per-shortcode geolocation override is emitted as data-geolocation, which the
// widget reads after CrumbWidgetConfig — so it overrides the admin setting.
$output = CrumbRenderer::render(
['server' => 'https://x/main_server', 'geolocation' => '0'],
['geolocation' => 'true']
);
$this->assertStringContainsString('data-geolocation="true"', $output);
}

public function testLanguageSettingMergesIntoConfig(): void
{
$output = CrumbRenderer::render([
Expand Down
Loading