Permalink
Browse files

Improve readonly redering (for single select at least..)

  • Loading branch information...
flack committed Dec 3, 2018
1 parent 44e6b31 commit 70fa18f99cec15fe0f1a9867b88e0775fda52456
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/midcom/datamanager/template/form.php
@@ -297,6 +297,17 @@ public function checkbox_widget(FormView $view, array $data)
public function choice_widget_collapsed(FormView $view, array $data)
{
if (!empty($data['attr']['readonly']) && empty($view->vars['multiple'])) {
if (isset($data['data'])) {
$selection = (string) $data['data'];
foreach ($data['choices'] as $choice) {
if ($data['is_selected']($choice->value, $selection)) {
return $this->renderer->humanize($choice->label) . $this->renderer->block($view, 'form_widget_simple', ['type' => "hidden"]);
}
}
}
return '';
}
$string = '<select';
if ( $data['required']
&& null === $data['placeholder']

0 comments on commit 70fa18f

Please sign in to comment.