예제 #1
0
Document::addTagLib(TimeCaptchaTag::class, 'form', 'timecaptcha');
Document::addTagLib(TimeSelectorTag::class, 'form', 'time');
Document::addTagLib(ValidationListenerTag::class, 'form', 'listener');
Document::addTagLib(FormGroupTag::class, 'form', 'group');
Document::addTagLib(HtmlIteratorTag::class, 'html', 'iterator');
Document::addTagLib(TemplateTag::class, 'iterator', 'fallback');
Document::addTagLib(HtmlIteratorItemTag::class, 'iterator', 'item');
Document::addTagLib(FillHtmlIteratorTag::class, 'item', 'fill-iterator');
Document::addTagLib(ButtonLanguageLabelTag::class, 'button', 'getstring');
Document::addTagLib(LabelLanguageLabelTag::class, 'label', 'getstring');
Document::addTagLib(SelectBoxGroupTag::class, 'select', 'group');
Document::addTagLib(SelectBoxOptionTag::class, 'select', 'option');
Document::addTagLib(SelectBoxOptionTag::class, 'group', 'option');
Document::addTagLib(LinkLanguageLabelActiveTag::class, 'aActive', 'getstring');
Document::addTagLib(LinkLanguageLabelTag::class, 'a', 'getstring');
Document::addTagLib(LinkLanguageTitleActiveTag::class, 'titleActive', 'getstring');
Document::addTagLib(LinkLanguageTitleTag::class, 'title', 'getstring');
Document::addTagLib(MediaInclusionTag::class, 'html', 'mediastream');
// APF\modules
Document::addTagLib(UmgtMediaInclusionLanguageLabelTag::class, 'media', 'getstring');
Document::addTagLib(SimpleCaptchaTag::class, 'form', 'captcha');
Document::addTagLib(ReCaptchaTag::class, 'form', 'recaptcha');
// APF\extensions
Document::addTagLib(DefinitionListDefinitionTag::class, 'list', 'elem_defdef');
Document::addTagLib(DefinitionListTermTag::class, 'list', 'elem_defterm');
Document::addTagLib(ListElementTag::class, 'list', 'elem_list');
// The 2.2/3.0 APF parser allows to globally register template expressions. This allows to register custom "short cuts"
// for template syntax (e.g. place holders, language labels). The following section registers the default APF expressions
// shipped with the release to have them available for all templates.
Document::addTemplateExpression(PlaceHolderTemplateExpression::class);
Document::addTemplateExpression(DynamicTemplateExpression::class);
예제 #2
0
 /**
  * Checks whether form control creation complies with APF DomNode creation.
  */
 public function testCreateFormElement()
 {
     $name = 'foo';
     $context = 'bar';
     $language = 'en';
     $form = new HtmlFormTag();
     $form->setContext($context);
     $form->setLanguage($language);
     // register mock implementation to allow check of method execution
     Document::addTagLib(TextFieldTagMock::class, 'test', 'text');
     $method = new ReflectionMethod(HtmlFormTag::class, 'createFormElement');
     $method->setAccessible(true);
     // note: arguments to be passed ad reference MUST be explicitly referenced with &
     $actual = $method->invokeArgs($form, [&$form, 'test:text', ['name' => $name, 'class' => 'text-field']]);
     /* @var $field TextFieldTagMock */
     $field = $form->getFormElementByName($name);
     $objectId = $field->getObjectId();
     // check identity to ensure references are returned
     $this->assertEquals(spl_object_hash($actual), spl_object_hash($field));
     // test element creation as part of the applied DomNode instance
     $this->assertInstanceOf(TextFieldTag::class, $field);
     // test object id, attributes, context language,
     $this->assertNotNull($objectId);
     $this->assertEquals($name, $field->getAttribute('name'));
     $this->assertEquals($context, $field->getContext());
     $this->assertEquals($language, $field->getLanguage());
     // check whether parent object is initialized (form)
     $this->assertEquals($form, $field->getParentObject());
     // check whether onParseTime() and onAfterAppend() are called
     $this->assertTrue($field->onParseTimeExecuted);
     $this->assertTrue($field->onAfterAppendExecuted);
     // check if internal array structure is valid
     $children = $form->getChildren();
     $this->assertNotEmpty($children);
     $this->assertContains($objectId, array_keys($children));
 }