You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The template helper generateAttribute() should allow to pass an optional noHtml or so param for option attributes.
Right now when you have a multiple select and you go for echo $this->generateAttribute('select_field') it will output a <ul> formatted list. However, what if I want to display something else than the <ul> list with it?
Of course you can get the raw values using $this->select_field but you would need to call deserialize() in combination with haste utilities. So in the easiest case you have to write something like this:
$options = deserialize($this->select_field, true);
foreach ($optionsas &$v) {
$v = \Haste\Util\Format::dcaValue('tl_iso_product', 'select_field', $v);
}
// Output every value with it's label here now.
I'd prefer to have something like this;
foreach ($this->generateAttribute('select_field', ['noHtml' => true]) {
// Output every value with it's label here now.
}
This would make the template a whole lot more consistent.
Why noHtml and not raw or something else? Well, prepared labels are not raw either, right? The equivalent of raw would be $this->select_field but what I want is everything except for the automated html markup. So, noHtml but I'm open for input :-)
The text was updated successfully, but these errors were encountered:
You only get the labels now, not the values anymore and you need to manually assign the label to the keys again.
To be more convenient, it should produce either this:
The template helper
generateAttribute()
should allow to pass an optionalnoHtml
or so param for option attributes.Right now when you have a multiple select and you go for
echo $this->generateAttribute('select_field')
it will output a<ul>
formatted list. However, what if I want to display something else than the<ul>
list with it?Of course you can get the raw values using
$this->select_field
but you would need to calldeserialize()
in combination with haste utilities. So in the easiest case you have to write something like this:I'd prefer to have something like this;
This would make the template a whole lot more consistent.
Why
noHtml
and notraw
or something else? Well, prepared labels are notraw
either, right? The equivalent ofraw
would be$this->select_field
but what I want is everything except for the automated html markup. So,noHtml
but I'm open for input :-)The text was updated successfully, but these errors were encountered: