예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function process($text, $langcode)
 {
     $new_text = $text;
     $filter_result = new FilterProcessResult($text);
     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;
 }