Open koseduhemak opened 7 years ago
just my 50 cents on this you may want to override \Zend\Form\View\Helper\AbstractHelper::prepareAttributes
@koseduhemak
Any workaround to get this specific attributes working?
The fastest way:
<?= $this->form()->openTag($form) ?>
<div itemprop="potentialAction">
@jcaillot
you may want to override \Zend\Form\View\Helper\AbstractHelper::prepareAttributes
Why? I think only the elements which wraps other elements should have these universal attributes. (e.g. form
and label
)
@froschdesign Thank you, used your workaround.
Another problem occurs at the input field:
<input itemprop="query-input" type="text" name="search_term_string" required="true" />
I know I can wrap that element in a div
too. But I think it must be added to the input field itself (because it is actually the query-input for my search engine). The complete desired markup I try to reproduce is from Google and is required to get a search box in the search results of Google:
<div itemscope itemtype="http://schema.org/WebSite">
<meta itemprop="url" content="https://www.example.com/"/>
<form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
<meta itemprop="target" content="https://query.example.com/search?q={search_term_string}"/>
<input itemprop="query-input" type="text" name="search_term_string" required/>
<input type="submit"/>
</form>
</div>
for more information: https://developers.google.com/search/docs/data-types/sitelinks-searchbox
@koseduhemak
Good catch! Then we must extend the $validGlobalAttributes
.
see #50
This repository has been closed and moved to laminas/laminas-form; a new issue has been opened at https://github.com/laminas/laminas-form/issues/10.
I tried to add some microdata to my form:
This does not work, as the specified attributes are not added if I render the form's open tag:
$this->form()->openTag($form);
Any workaround to get this specific attributes working?