Skip to content

Commit

Permalink
EWPP-4984: Remove social feed widget type from the Webtools media sou…
Browse files Browse the repository at this point in the history
…rce options.
  • Loading branch information
22Alexandra committed Dec 10, 2024
1 parent a40310e commit 1e41947
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ class WebtoolsMediaConstraint extends Constraint {
*/
public $blacklistMessage = 'This service is supported by a dedicated asset type or feature, please use that instead.';

/**
* The unsupported widget type message.
*
* @var string
*/
public $unsupportedWidgetTypeMessage = 'The service "%widget_type" is no longer supported.';

/**
* The incorrect WCLOUD URL message.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ public function validate($value, Constraint $constraint) {
$snippet['service'] = $snippet['utility'];
}

if (!isset($widget_types[$constraint->widgetType])) {
$this->context->addViolation($constraint->unsupportedWidgetTypeMessage, ['%widget_type' => $constraint->widgetType]);
return;
}

// Add violation in case incorrect services.
$services = $widget_types[$constraint->widgetType]['services'] ?? [$widget_types[$constraint->widgetType]['service']];
if (empty($snippet['service']) || (!empty($services) && !in_array($snippet['service'], $services))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,6 @@ public function getWidgetTypes() {
'default_thumbnail' => 'maps-embed-no-bg.png',
'blacklist' => [],
],
'social_feed' => [
'name' => $this->t('Social feed'),
// @deprecated Use services key instead.
'service' => '',
'services' => ['smk'],
'default_thumbnail' => 'twitter-embed-no-bg.png',
'blacklist' => [],
],
'opwidget' => [
'name' => $this->t('OP Publication list'),
// @deprecated Use services key instead.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function getTestMediaWebtoolsSourceData(): array {
'charts',
'service',
'/charts-embed-no-bg.png',
'smk',
'map',
'',
],
[
Expand All @@ -204,7 +204,7 @@ public function getTestMediaWebtoolsSourceData(): array {
'chart',
'service',
'/charts-embed-no-bg.png',
'smk',
'map',
'',
],
[
Expand All @@ -213,25 +213,16 @@ public function getTestMediaWebtoolsSourceData(): array {
'racing',
'service',
'/charts-embed-no-bg.png',
'smk',
'map',
'',
],
['map', 'Map', 'map', 'service', '/maps-embed-no-bg.png', 'smk', ''],
['map', 'Map', 'map', 'service', '/maps-embed-no-bg.png', 'chart', ''],
[
'chart',
'Chart',
'qlik',
'service',
'/charts-embed-no-bg.png',
'smk',
'',
],
[
'social_feed',
'Social feed',
'smk',
'service',
'/twitter-embed-no-bg.png',
'map',
'',
],
Expand All @@ -241,7 +232,7 @@ public function getTestMediaWebtoolsSourceData(): array {
'opwidget',
'utility',
'/generic.png',
'smk',
'chart',
'',
],
['cdown', 'Countdown', 'cdown', 'service', '/generic.png', 'map', ''],
Expand Down

0 comments on commit 1e41947

Please sign in to comment.