예제 #1
0
 /**
  * Generates a widget to show a html grid Form
  *
  * @param \Engine\Crud\Form\Field $Form
  * @return string
  */
 public static function _(Field $field)
 {
     $label = $field->getLabel();
     $code = '';
     if ($label) {
         $code = '<label class="control-label" for="' . $field->getKey() . '">' . $field->getLabel() . '</label>';
     }
     return $code;
 }
예제 #2
0
 /**
  * Render extjs mail form field
  *
  * @param \Engine\Crud\Form\Field $field
  * @return string
  */
 public static function _(Field $field)
 {
     $fieldCode = [];
     if ($field->isHidden()) {
         $fieldCode[] = "xtype: 'hiddenfield'";
     } else {
         $fieldCode[] = "xtype: 'textfield'";
     }
     if ($field->isNotEdit()) {
         $fieldCode[] = "readOnly: true";
     }
     $fieldCode[] = "name: '" . $field->getKey() . "'";
     $fieldCode[] = "allowBlank: " . ($field->isRequire() ? "false" : "true");
     $label = $field->getLabel();
     if ($label) {
         $fieldCode[] = "fieldLabel: '" . $label . "'";
     }
     $desc = $field->getDesc();
     if ($desc) {
         $fieldCode[] = "boxLabel: '" . $desc . "'";
     }
     $width = $field->getWidth();
     if ($width) {
         $fieldCode[] = "width: " . $width;
     }
     $fieldCode[] = "vtype: 'email'";
     return forward_static_call(['self', '_implode'], $fieldCode);
 }