/** * {@inheritDoc} */ public function form(PhpRenderer $view, array $options = []) { $urlInput = new UrlElement('o:media[__index__][o:source]'); $urlInput->setOptions(['label' => $view->translate('Video URL'), 'info' => $view->translate('URL for the video to embed.')]); $urlInput->setAttributes(['id' => 'media-youtube-source-__index__', 'required' => true]); $urlInput->setAttributes(['id' => 'media-youtube-source-__index__', 'required' => true]); $startInput = new Text('o:media[__index__][start]'); $startInput->setOptions(['label' => $view->translate('Start'), 'info' => $view->translate('Begin playing the video at the given number of seconds from the start of the video.')]); $endInput = new Text('o:media[__index__][end]'); $endInput->setOptions(['label' => $view->translate('End'), 'info' => $view->translate('End playing the video at the given number of seconds from the start of the video.')]); return $view->formRow($urlInput) . $view->formRow($startInput) . $view->formRow($endInput); }
/** * {@inheritDoc} */ public function form(PhpRenderer $view, array $options = []) { $urlInput = new UrlElement('o:media[__index__][o:source]'); $urlInput->setOptions(['label' => $view->translate('oEmbed URL'), 'info' => $view->translate('URL for the media to embed.')]); $urlInput->setAttributes(['id' => 'media-oembed-source-__index__', 'required' => true]); return $view->formRow($urlInput); }
/** * {@inheritDoc} */ public function form(PhpRenderer $view, array $options = []) { $urlInput = new UrlElement('o:media[__index__][ingest_url]'); $urlInput->setOptions(['label' => $view->translate('URL'), 'info' => $view->translate('A URL to the media.')]); $urlInput->setAttributes(['id' => 'media-url-ingest-url-__index__', 'required' => true]); return $view->formRow($urlInput); }
public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() { $element = new UrlElement(); $element->setAttributes(array('allowAbsolute' => true, 'allowRelative' => false)); $inputSpec = $element->getInputSpecification(); $this->assertArrayHasKey('validators', $inputSpec); $this->assertInternalType('array', $inputSpec['validators']); $expectedClasses = array('Zend\\Validator\\Uri'); foreach ($inputSpec['validators'] as $validator) { $class = get_class($validator); $this->assertTrue(in_array($class, $expectedClasses), $class); switch ($class) { case 'Zend\\Validator\\Uri': $this->assertEquals(true, $validator->getAllowAbsolute()); $this->assertEquals(false, $validator->getAllowRelative()); break; default: break; } } }
public function __construct($name = null) { parent::__construct('links'); $weight_hidden = new Element\Hidden('weight'); $title_text = new Element\Text('name'); $title_text->setLabel('Title'); $title_text->setLabelAttributes(array('class' => 'type_text')); $title_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => true)); $url_text = new Element\Url('ref'); $url_text->setLabel('Url'); $url_text->setLabelAttributes(array('class' => 'type_text')); $url_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => true)); $description_textarea = new Element\Textarea('description'); $description_textarea->setLabel('Description'); $description_textarea->setLabelAttributes(array('class' => 'type_text')); $description_textarea->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...')); $this->add($weight_hidden); $this->add($title_text); $this->add($url_text); $this->add($description_textarea); }
public function __construct() { parent::__construct('online'); $this->setHydrator(new ArraySerializableHydrator(false)); $adress_text = new Element\Url('url'); $adress_text->setLabel('Url'); $adress_text->setLabelAttributes(array('class' => 'type_text')); $adress_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type adress in format', 'required' => true)); $this->add($adress_text); $this->add(array('type' => 'Button', 'name' => 'submit', 'options' => array('label' => 'delete'), 'attributes' => array('class' => 'btn btn btn_red3'))); }