Skip to content

Commit

Permalink
Merge pull request #14 from wfp/develop
Browse files Browse the repository at this point in the history
Merge develop
  • Loading branch information
lashab committed Jun 6, 2016
2 parents 33c5b35 + 6a8aeae commit c7edd21
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/Plugin/Filter/FilterSurvey.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@ public function process($text, $langcode) {
$new_text = $text;
$filter_result = new FilterProcessResult($text);

preg_match('/\[survey\:.+\]/', $text, $result);
$token = $result[0];
$start = strpos($token, ':') + 1;
$length = strpos($token, ']') - $start;
$id = substr($token, $start, $length);
$block = Block::load($id);
if ($block) {
$replace = $block->get('settings')['html'];
$new_text = str_replace($token, $replace, $text);
$filter_result->setProcessedText($new_text);
$filter_result->setCacheTags($block->getCacheTags());
if (preg_match('/\[survey\:.+\]/', $text, $result)) {
$token = $result[0];
$start = strpos($token, ':') + 1;
$length = strpos($token, ']') - $start;
$id = substr($token, $start, $length);
$block = Block::load($id);
if ($block) {
$replace = $block->get('settings')['html'];
$new_text = str_replace($token, $replace, $text);
$filter_result->setProcessedText($new_text);
$filter_result->setCacheTags($block->getCacheTags());
}
}

return $filter_result;
Expand Down

0 comments on commit c7edd21

Please sign in to comment.