Skip to content
Snippets Groups Projects
RenderInlineForm.php 2.37 KiB
Newer Older
<?php
/**
 * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved.
 *
 * BOKEH is free software; you can redistribute it and/or modify
 * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
 * the Free Software Foundation.
 *
 * There are special exceptions to the terms and conditions of the AGPL as it
 * is applied to this software (see README file).
 *
 * BOKEH is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
 * along with BOKEH; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 */


class Intonation_View_RenderInlineForm extends Intonation_View_RenderForm {

  public function renderInlineForm($form, $buttons =[]) {
    $form->setAttrib('class', 'inline_form row no-gutters');
    $html = parent::renderForm($form, $buttons);
    return $html;
  }


  protected function _getFieldsetDecorator($form) {
Ghislain Loas's avatar
Ghislain Loas committed
    $decorators = ['FormElements',
                   ['HtmlTag',
Ghislain Loas's avatar
Ghislain Loas committed
                    ['tag' => 'div', 'class' => 'col form-row align-items-center justify-content-center']]];
    return $decorators;
  }


  protected function _labelForTableRendering($element, $decorator, $newDecorators, $name) {
    if('Zend_Form_Element_Hidden' == $element->getType()) {
      $newDecorators[] = ['input_data' => 'HtmlTag',
                          ['tag' => 'div', 'class' => 'd-none']];
      $decorator->setOptions([]);
      $newDecorators[$name] = $decorator;
      return $newDecorators;
    }

Ghislain Loas's avatar
Ghislain Loas committed
    $newDecorators[] = ['input_data' => 'HtmlTag',
                        ['tag' => 'div', 'class' => 'row input-group mb-2']];
    $decorator->setOptions([]);
    $newDecorators[$name] = $decorator;
    $newDecorators[] = ['HtmlTag', ['tag' => 'div', 'class' => 'col-12 col-sm']];

    $class = $this->_getWrapperElementClass($element);

    $newDecorators[] = ['HtmlTagWrapper',
                        ['tag' => 'div',
                         'class' => 'col row form-group no-gutters '
                         . $class
                         . ' inline_form_'
                         . $class]];

    return $newDecorators;
  }
}