withAutoProcessContent() 공개 메소드

Whether shortcode content will be automatically processed and handler already receives shortcode with processed content. If false, every shortcode handler needs to process content on its own. Default true.
public withAutoProcessContent ( boolean $flag ) : self
$flag boolean True if enabled (default), false otherwise
리턴 self
예제 #1
0
 public function testProcessContentIfHasChildHandlerButNotParent()
 {
     $handlers = new HandlerContainer();
     $handlers->add('valid', function (ShortcodeInterface $s) {
         return $s->getName();
     });
     $text = 'x [invalid   ] [valid /] [/invalid] y';
     $processor = new Processor(new RegexParser(), $handlers);
     $this->assertSame('x [invalid   ] valid [/invalid] y', $processor->withAutoProcessContent(true)->process($text));
     $this->assertSame('x [invalid   ] [valid /] [/invalid] y', $processor->withAutoProcessContent(false)->process($text));
 }
예제 #2
0
 public function testExceptionOnInvalidAutoProcessFlag()
 {
     $processor = new Processor(new RegularParser(), new HandlerContainer());
     $this->setExpectedException('InvalidArgumentException');
     $processor->withAutoProcessContent(new \stdClass());
 }