-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from GSA/feature/DIGITAL-38-migrate-shortcodes
Digital-38: migrate shortcodes templates
- Loading branch information
Showing
31 changed files
with
860 additions
and
588 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,7 @@ module: | |
text: 0 | ||
token: 0 | ||
toolbar: 0 | ||
twig_field_value: 0 | ||
twig_tweak: 0 | ||
update: 0 | ||
user: 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Index: src/Plugin/Filter/EmbeddedContent.php | ||
IDEA additional info: | ||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | ||
<+>UTF-8 | ||
=================================================================== | ||
diff --git a/src/Plugin/Filter/EmbeddedContent.php b/src/Plugin/Filter/EmbeddedContent.php | ||
--- a/src/Plugin/Filter/EmbeddedContent.php | ||
+++ b/src/Plugin/Filter/EmbeddedContent.php (date 1731427147463) | ||
@@ -88,6 +88,8 @@ | ||
$replacement = $instance->build(); | ||
$context = new RenderContext(); | ||
$render = $this->renderer->executeInRenderContext($context, fn() => $this->renderer->render($replacement)); | ||
+ // Allow in the xml by replacing them with decimal entity. | ||
+ $render = str_replace(' ', ' ', $render); | ||
if (!$context->isEmpty()) { | ||
$bubbleable = $bubbleable->merge($context->pop()); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...dules/custom/ec_shortcodes/src/Plugin/EmbeddedContent/ECShortCodesFeaturedResourceExt.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
namespace Drupal\ec_shortcodes\Plugin\EmbeddedContent; | ||
|
||
use Drupal\Core\Form\FormStateInterface; | ||
use Drupal\Core\StringTranslation\StringTranslationTrait; | ||
use Drupal\embedded_content\EmbeddedContentInterface; | ||
use Drupal\embedded_content\EmbeddedContentPluginBase; | ||
|
||
/** | ||
* Plugin iframes. | ||
* | ||
* @EmbeddedContent( | ||
* id = "ec_shortcodes_featured_resource_ext", | ||
* label = @Translation("Featured Resource - External"), | ||
* description = @Translation("Renders a styled button link."), | ||
* ) | ||
*/ | ||
class ECShortCodesFeaturedResourceExt extends EmbeddedContentPluginBase implements EmbeddedContentInterface { | ||
|
||
use StringTranslationTrait; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function defaultConfiguration() { | ||
return [ | ||
'kicker' => NULL, | ||
'url' => NULL, | ||
'title' => NULL, | ||
'summary' => NULL, | ||
]; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function build(): array { | ||
return [ | ||
'#theme' => 'ec_shortcodes_featured_resource_ext', | ||
'#kicker' => $this->configuration['kicker'], | ||
'#url' => $this->configuration['url'], | ||
'#title' => $this->configuration['text'], | ||
'#summary' => $this->configuration['summary'], | ||
]; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function buildConfigurationForm(array $form, FormStateInterface $form_state) { | ||
$form['kicker'] = [ | ||
'#type' => 'textfield', | ||
'#title' => $this->t('Kicker'), | ||
'#default_value' => $this->configuration['kicker'], | ||
'#required' => TRUE, | ||
]; | ||
$form['url'] = [ | ||
'#type' => 'url', | ||
'#title' => $this->t('Url'), | ||
'#default_value' => $this->configuration['url'], | ||
'#required' => TRUE, | ||
]; | ||
$form['title'] = [ | ||
'#type' => 'textfield', | ||
'#title' => $this->t('Text'), | ||
'#default_value' => $this->configuration['title'], | ||
'#required' => TRUE, | ||
]; | ||
$form['summary'] = [ | ||
'#type' => 'textfield', | ||
'#title' => $this->t('Summary'), | ||
'#default_value' => $this->configuration['summary'], | ||
'#required' => TRUE, | ||
]; | ||
return $form; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function isInline(): bool { | ||
return FALSE; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.