Example #1
0
 public function compileTag()
 {
     if (!$this->hasNode('class')) {
         $this->setNode('class', new \Twig_Node_Expression_Constant('date_field', $this->lineno));
     }
     parent::compileTag();
     $this->requireCss(\Fierce\Env::get('fierce_src') . 'css/date-field.css');
     $this->requireScript(\Fierce\Env::get('fierce_src') . 'scripts/calendar-field.controller.js');
 }
Example #2
0
 public function compileTag()
 {
     // apply class to the field
     $classNode = new \Twig_Node_Expression_Constant('tag_field large ', $this->lineno);
     if ($this->hasNode('class')) {
         $classNode = new \Twig_Node([$classNode, $this->getNode('class')]);
     }
     $this->setNode('class', $classNode);
     // create list id node
     $this->compiler->write('$context[\'_fierce_tag_list_id\'] = trim(preg_replace(\'/[^a-zA-Z0-9_]+/\', \'_\', ')->subcompile($this->getNode('name'))->raw("), '_') . '_tags';\n");
     $listIdNode = new \Twig_Node_Expression_Name('_fierce_tag_list_id', $this->lineno);
     // output field
     parent::compileTag();
     // output list
     $this->openTag('ul', ['id' => $listIdNode, 'class' => 'tag_list']);
     $this->compiler->addDebugInfo($this)->write("\$context['_fierce_tag_list_options'] = twig_ensure_traversable(")->subcompile($this->getNode('options'))->raw(");\n");
     $this->compiler->write("foreach (\$context['_fierce_tag_list_options'] as \$fierceTagListOption) {\n")->indent()->write("print '<li>' . htmlspecialchars(\$fierceTagListOption) . '</li>';\n")->outdent()->write("}\n");
     self::closeTag('ul');
     // add js
     $this->requireScript(\Fierce\Env::get('fierce_src') . 'scripts/tag-field.controller.js');
 }
Example #3
0
 public function compileTag()
 {
     $this->openFieldRow();
     parent::compileTag();
     $this->closeFieldRow();
 }