Skip to content

Commit

Permalink
Merge pull request #52 from werkbot/hotfix/2.1.6/revert-change
Browse files Browse the repository at this point in the history
Removed check for Show/Hide setting on shortcode
  • Loading branch information
aletail authored May 30, 2024
2 parents f46e285 + 51cf36c commit f339fc3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/NewsletterShortcodeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@
use SilverStripe\Control\Controller;
use SilverStripe\View\Parsers\ShortcodeParser;

class NewsletterShortcodeProvider extends ShortcodeParser{
class NewsletterShortcodeProvider extends ShortcodeParser
{
/*
[newsletterform,class="form newsletter-form"]
*/
public static function handle_shortcode($args, $content, $parser, $shortcode, $extra = array()){
public static function handle_shortcode($args, $content, $parser, $shortcode, $extra = array())
{
$PopupContent = '';
// Add Content before form
if ($content){
if ($content) {
$PopupContent = $parser->parse($content);
}
// If class add wrapper div
if (isset($args['class'])){
$PopupContent .= '<div class="'.$args['class'].'">';
if (isset($args['class'])) {
$PopupContent .= '<div class="' . $args['class'] . '">';
}
// Get Form HTML
if (Controller::curr()->owner->NewsletterShowHide){
$PopupContent .= Controller::curr()->NewsletterForm()
->setHTMLID("NewsletterForm".rand(0,100))
->setFormAction(Controller::join_links(Controller::curr()->owner->Link(), 'NewsletterForm'))
->forTemplate();
}
$PopupContent .= Controller::curr()->NewsletterForm()
->setHTMLID("NewsletterForm" . rand(0, 100))
->setFormAction(Controller::join_links(Controller::curr()->owner->Link(), 'NewsletterForm'))
->forTemplate();
// End wrapper div
if (isset($args['class'])){
if (isset($args['class'])) {
$PopupContent .= '</div>';
}
// Return full html
Expand Down

0 comments on commit f339fc3

Please sign in to comment.