/** * Generates a widget to show a html form * * @param \Engine\Crud\Form\Extjs $form * @return string */ public static function _(Form $form) { $title = $form->getTitle(); $primary = $form->getPrimaryField(); $key = $primary ? $primary->getKey() : false; $url = $form->getAction() . "/save"; $code = "\n Ext.define('" . static::getFormName() . "', {\n extend: 'Ext.ux.crud.Form',\n store: '" . static::getStoreName() . "',\n alias: 'widget." . static::$_module . ucfirst(static::$_prefix) . "Form',\n title: '" . $form->getTitle() . "',\n bodyPadding: 5,\n autoScroll:true,\n waitMsgTarget: true,\n fieldDefaults: {\n labelAlign: 'right',\n labelWidth: 85,\n msgTarget: 'side'\n },\n defaultType: 'textfield',\n defaults: {\n width: 280\n },\n buttonAlign: 'left',\n "; /*$width = $form->getWidth(); if ($width) { $code .= "width: ".$width.", "; } $height = $form->getHeight(); if ($width) { $code .= "height: ".$height.", "; }*/ $code .= "url: '" . $url . "',\n "; $code .= "link: '" . $form->getLink() . "',\n "; if ($key) { $code .= "primaryKey: '" . $key . "',\n "; } static::addRequires("Ext.form.field.*"); static::addRequires("Ext.ux.crud.Form"); $code .= "itemId: '" . static::$_module . ucfirst(static::$_prefix) . "Form',\n "; return $code; }