示例#1
0
 /**
  * Only renders the summary representation of a summary form
  *
  * @param SummaryFormInterface $form
  * @return string
  */
 public function renderSummary(SummaryFormInterface $form)
 {
     $baseFieldset = $form->getBaseFieldset();
     if (!isset($baseFieldset)) {
         throw new \InvalidArgumentException('For the Form ' . get_class($form) . ' there is no Basefieldset');
     }
     $markup = '<div class="panel panel-default" style="min-height: 100px;">
                 <div class="panel-body">%s%s</div></div>';
     $buttonMarkup = false === $form->getOption('editable') ? '' : '<button type="button" class="pull-right btn btn-default btn-xs sf-edit">' . '<span class="yk-icon yk-icon-edit"></span> ' . $this->getView()->translate('Edit') . '</button>';
     $elementMarkup = $this->renderSummaryElement($baseFieldset);
     return sprintf($markup, $buttonMarkup, $elementMarkup);
 }
 /**
  * Only renders the summary representation of a summary form
  * 
  * @param SummaryFormInterface $form
  * @return string
  */
 public function renderSummary(SummaryFormInterface $form)
 {
     return '<div class="panel panel-default" style="min-height: 100px;">
                 <div class="panel-body"><button type="button" class="pull-right btn btn-default btn-xs sf-edit">' . '<span class="yk-icon yk-icon-edit"></span> ' . $this->getView()->translate('Edit') . '</button>' . $this->renderSummaryElement($form->getBaseFieldset()) . '</div></div>';
 }
示例#3
0
 /**
  * Only renders the summary representation of a summary form
  *
  * @param SummaryFormInterface $form
  * @return string
  */
 public function renderSummary(SummaryFormInterface $form)
 {
     $form->prepare();
     $baseFieldset = $form->getBaseFieldset();
     if (!isset($baseFieldset)) {
         throw new \InvalidArgumentException('For the Form ' . get_class($form) . ' there is no Basefieldset');
     }
     $dataAttributesMarkup = '';
     foreach ($form->getAttributes() as $dataKey => $dataValue) {
         if (preg_match('/^data-/', $dataKey)) {
             $dataAttributesMarkup .= sprintf(' %s="%s"', $dataKey, $dataValue);
         }
     }
     $markup = '<div class="panel panel-default" style="min-height: 100px;"' . $dataAttributesMarkup . '>
                 <div class="panel-body"><div class="sf-controls">%s</div>%s</div></div>';
     $view = $this->getView();
     $buttonMarkup = false === $form->getOption('editable') ? '' : '<button type="button" class="btn btn-default btn-xs sf-edit">' . '<span class="yk-icon yk-icon-edit"></span> ' . $view->translate('Edit') . '</button>';
     if (($controlButtons = $form->getOption('control_buttons')) !== null) {
         $buttonMarkup .= PHP_EOL . implode(PHP_EOL, array_map(function (array $buttonSpec) use($view) {
             return '<button type="button" class="btn btn-default btn-xs' . (isset($buttonSpec['class']) ? ' ' . $buttonSpec['class'] : '') . '">' . (isset($buttonSpec['icon']) ? '<span class="yk-icon yk-icon-' . $buttonSpec['icon'] . '"></span> ' : '') . $view->translate($buttonSpec['label']) . '</button>';
         }, $controlButtons));
     }
     $elementMarkup = $this->renderSummaryElement($baseFieldset);
     return sprintf($markup, $buttonMarkup, $elementMarkup);
 }