/**
  * Returns HTML code for a field
  * 
  * @param   sfModelGeneratorConfigurationField  $field
  * @return  string  HTML code
  */
 public function renderField($field)
 {
     $html = $this->getColumnGetter($field->getName(), true);
     if ($renderer = $field->getRenderer()) {
         $html = sprintf("{$html} ? call_user_func_array( %s, array_merge( array(%s), %s ) ) : ' '", $this->asPhp($renderer), $html, $this->asPhp($field->getRendererArguments()));
     } else {
         if ($field->isComponent()) {
             return sprintf("Partial::component( '%s', '%s', array( 'type' => 'list', '%s' => \$%s ) )", $this->getModuleName(), $field->getName(), $this->getSingularName(), $this->getSingularName());
         } else {
             if ($field->isPartial()) {
                 return sprintf("Partial::get( '%s', array( 'type' => 'list', '%s' => \$%s ) )", $field->getName(), $this->getSingularName(), $this->getSingularName());
             } else {
                 if ('Date' == $field->getType()) {
                     $html = sprintf("false !== strtotime( {$html} ) ? Date::formatDate( %s, \"%s\" ) : ' '", $html, $field->getConfig('date_format', 'f'));
                 } else {
                     if ('Boolean' == $field->getType()) {
                         $html = sprintf("'<div class=\"ui-icon' . ( %s ? ' ui-icon-check' : ' ui-icon-close' ) . '\" title=\"'" . " . I18n::__( 'admin.label.' . ( %s ? '' : 'un' ) . 'checked' ) . '\"></div>'", $html, $html);
                     }
                 }
             }
         }
     }
     if ($field->isLink()) {
         $html = sprintf("Url::link( %s, '%s', \$%s )", $html, $this->getUrlForAction('edit'), $this->getSingularName());
     }
     return $html;
 }
 /**
  * Returns HTML code for a field.
  *
  * @param sfModelGeneratorConfigurationField $field The field
  *
  * @return string HTML code
  */
 public function renderField($field)
 {
     $fieldName = $field->getName();
     $html = $this->getColumnGetter($fieldName, true);
     if ($renderer = $field->getRenderer()) {
         $html = sprintf('%s ? call_user_func_array(%s, array_merge(array(%s), %s)) : "&nbsp;"', $html, $this->asPhp($renderer), $html, $this->asPhp($field->getRendererArguments()));
     } else {
         if ($field->isComponent()) {
             return sprintf("get_component('%s', '%s', array('type' => 'list', '%s' => \$%s))", $this->getModuleName(), $fieldName, $this->getSingularName(), $this->getSingularName());
         } else {
             if ($field->isPartial()) {
                 return sprintf("get_partial('%s/%s', array('type' => 'list', '%s' => \$%s))", $this->getModuleName(), $fieldName, $this->getSingularName(), $this->getSingularName());
             } else {
                 if ('Date' == $field->getType()) {
                     $html = sprintf("false !== strtotime({$html}) ? format_date(%s, \"%s\") : '&nbsp;'", $html, $field->getConfig('date_format', 'f'));
                 } else {
                     if ('Boolean' == $field->getType()) {
                         $html = "sprintf('<span class=\"bloc bool_%s {field: \\'%s\\'}\" title=\"%s\"></span>', " . $html . " ? 'tick' : 'cross', '" . $fieldName . "', __('Cliquer pour modifier'))";
                     }
                 }
             }
         }
     }
     if ($field->isLink()) {
         $html = sprintf("link_to(%s, '%s', \$%s)", $html, $this->getUrlForAction('edit'), $this->getSingularName());
     }
     return $html;
 }
Пример #3
0
 /**
  * Returns HTML code for a field.
  *
  * @param sfModelGeneratorConfigurationField $field The field
  *
  * @return string HTML code
  */
 public function renderField($field)
 {
     $fieldName = $field->getName();
     $html = $this->getColumnGetter($fieldName, true);
     if ($renderer = $field->getRenderer()) {
         $html = sprintf('%s ? call_user_func_array(%s, array_merge(array(%s), %s)) : "&nbsp;"', $html, $this->asPhp($renderer), $html, $this->asPhp($field->getRendererArguments()));
     } else {
         if ($field->isComponent()) {
             return sprintf("get_component('%s', '%s', array('type' => 'list', '%s' => \$%s))", $this->getModuleName(), $fieldName, $this->getSingularName(), $this->getSingularName());
         } else {
             if ($field->isPartial()) {
                 return sprintf("get_partial('%s/%s', array('type' => 'list', '%s' => \$%s))", $this->getModuleName(), $fieldName, $this->getSingularName(), $this->getSingularName());
             } else {
                 if ('Date' == $field->getType()) {
                     $html = sprintf("false !== strtotime({$html}) ? format_date(%s, \"%s\") : '&nbsp;'", $html, $field->getConfig('date_format', 'f'));
                 } else {
                     if ('Boolean' == $field->getType()) {
                         $html = "sprintf('<a class=\"s16block s16_%s {field: \\'%s\\'}\" title=\"%s\"></a>', " . $html . " ? 'tick' : 'cross', '" . $fieldName . "', __('Click to edit'))";
                     } elseif ($relation = $this->table->getRelationHolder()->getLocalByColumnName($fieldName)) {
                         if ('DmMedia' === $relation->getClass()) {
                             $html = '$' . $this->getSingularName() . "->get('" . $relation->getLocalColumnName() . "') ? get_partial('dmMedia/viewLittle', array('object' => \$" . $this->getSingularName() . "->get('" . $relation->getAlias() . "'))) : '-'";
                         } else {
                             $localModule = $this->moduleManager->getModuleByModel($relation->getClass());
                             if ($localModule && $localModule->hasAdmin()) {
                                 $html = "(\$sf_user->canAccessToModule('{$localModule->getKey()}')\n? _link(\${$this->getSingularName()}->get('{$relation->getAlias()}'))\n->text(\${$this->getSingularName()}->get('{$relation->getAlias()}')->__toString())\n->set('.associated_record.s16right.s16_arrow_up_right_medium')\n: \$" . $this->getSingularName() . "->get('" . $relation->getAlias() . "'))";
                             } else {
                                 $html = "\$" . $this->getSingularName() . "->get('" . $relation->getAlias() . "')";
                             }
                             $html = '$' . $this->getSingularName() . "->get('" . $relation->getLocalColumnName() . "') ? " . $html . " : '-'";
                         }
                     } elseif (substr($fieldName, -5) === '_list') {
                         if (!($relation = $this->table->getRelationHolder()->get($alias = dmString::camelize(substr($fieldName, 0, strlen($fieldName) - 5))))) {
                             $relation = $this->table->getRelationHolder()->get($alias = substr($fieldName, 0, strlen($fieldName) - 5));
                         }
                         if ($relation) {
                             $html = "\$sf_context->getServiceContainer()->mergeParameter('related_records_view.options', array(\n  'record' => \$" . $this->getSingularName() . ",\n  'alias'  => '" . $alias . "'\n))->getService('related_records_view')->render()";
                         }
                     } elseif ('dm_gallery' === $fieldName) {
                         $html = "get_partial('dmMedia/galleryLittle', array('record' => \$" . $this->getSingularName() . "));";
                     } else {
                         $html = 'htmlentities(dmString::truncate(' . $html . ', ' . $field->getConfig('truncate', sfConfig::get('dm_admin_list_truncate', 120)) . '), ENT_COMPAT, \'UTF-8\')';
                         if ($this->module->getTable()->isMarkdownColumn($fieldName)) {
                             $html = "str_replace(array('*', '#'), '', " . $html . ")";
                         }
                     }
                 }
             }
         }
     }
     if ($field->isLink()) {
         $html = sprintf("_link('@%s?action=edit&pk='.\$%s->getPrimaryKey())->text(%s)->addClass('link_edit')", $this->module->getUnderscore(), $this->getSingularName(), $html);
     }
     return $html;
 }
 protected function compile()
 {
     parent::compile();
     // ===================================
     // = Add for exporting configuration =
     // ===================================
     $this->configuration['credentials']['export'] = array();
     $this->configuration['export'] = array('fields' => array(), 'title' => $this->getExportTitle(), 'actions' => $this->getExportActions() ? $this->getExportActions() : array('_list' => array('action' => 'index', 'label' => 'Back')));
     $config = $this->getConfig();
     foreach (array_keys($config['default']) as $field) {
         $formConfig = array_merge($config['default'][$field], isset($config['form'][$field]) ? $config['form'][$field] : array());
         $this->configuration['export']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge(array('label' => sfInflector::humanize(sfInflector::underscore($field))), $config['default'][$field], isset($config['export'][$field]) ? $config['export'][$field] : array()));
     }
     foreach ($this->getExportDisplay() as $field) {
         list($field, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($field);
         $this->configuration['export']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge(array('type' => 'Text', 'label' => sfInflector::humanize(sfInflector::underscore($field))), isset($config['default'][$field]) ? $config['default'][$field] : array(), isset($config['export'][$field]) ? $config['export'][$field] : array(), array('flag' => $flag)));
     }
     // export actions
     foreach ($this->configuration['export']['actions'] as $action => $parameters) {
         $this->configuration['export']['actions'][$action] = $this->fixActionParameters($action, $parameters);
     }
     $this->configuration['export']['display'] = array();
     foreach ($this->getExportDisplay() as $name) {
         list($name, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
         if (!isset($this->configuration['export']['fields'][$name])) {
             throw new InvalidArgumentException(sprintf('The field "%s" does not exist.', $name));
         }
         $field = $this->configuration['export']['fields'][$name];
         $field->setFlag($flag);
         $this->configuration['export']['display'][$name] = $field;
     }
 }
 /**
  * Gets the fields that represents the form.
  *
  * If no form.display parameter is passed in the configuration,
  * all the fields from the form are returned (dynamically).
  *
  * @param sfForm $form    The form with the fields
  * @param string $context The display context
  */
 public function getFormFields(sfForm $form, $context)
 {
     $config = $this->getConfig();
     $method = sprintf('get%sDisplay', ucfirst($context));
     if (!($itemsLists = $this->{$method}())) {
         $itemsLists = $this->getFormDisplay();
     }
     if ($itemsLists) {
         $fields = array();
         // with itemsLists?
         if (!is_array(current($itemsLists))) {
             $itemsLists = array($itemsLists);
         }
         foreach ($itemsLists as $itemsList => $fieldsets) {
             $fields[$itemsList] = array();
             // with fieldsets?
             if (!is_array(current($fieldsets))) {
                 $fieldsets = array('NONE' => $fieldsets);
             }
             foreach ($fieldsets as $fieldset => $names) {
                 $fields[$itemsList][$fieldset] = array();
                 foreach ($names as $name) {
                     list($name, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
                     if (!isset($this->configuration[$context]['fields'][$name])) {
                         $this->configuration[$context]['fields'][$name] = new sfModelGeneratorConfigurationField($name, array_merge(isset($config['default'][$name]) ? $config['default'][$name] : array(), isset($config['form'][$name]) ? $config['form'][$name] : array(), isset($config[$context][$name]) ? $config[$context][$name] : array(), array('is_real' => false, 'type' => 'Text', 'flag' => $flag)));
                     }
                     $field = $this->configuration[$context]['fields'][$name];
                     $field->setFlag($flag);
                     $fields[$itemsList][$fieldset][$name] = $field;
                 }
             }
         }
         return $fields;
     }
     $fields = array();
     foreach ($form->getWidgetSchema()->getPositions() as $name) {
         $fields[$name] = new sfModelGeneratorConfigurationField($name, array_merge(isset($config['default'][$name]) ? $config['default'][$name] : array(), isset($config['form'][$name]) ? $config['form'][$name] : array(), isset($config[$context][$name]) ? $config[$context][$name] : array(), array('is_real' => false, 'type' => 'Text')));
     }
     return array(array('NONE' => $fields));
 }
 protected function mapFieldName(sfModelGeneratorConfigurationField $field)
 {
     return $field->getName();
 }
 /**
  * Returns HTML code for a field.
  *
  * @param sfModelGeneratorConfigurationField $field The field
  *
  * @return string HTML code
  */
 public function renderField($field)
 {
     $html = $this->getColumnGetter($field->getName(), true);
     if ($renderer = $field->getRenderer()) {
         $html = sprintf("{$html} ? call_user_func_array(%s, array_merge(array(%s), %s)) : '&nbsp;'", $this->asPhp($renderer), $html, $this->asPhp($field->getRendererArguments()));
     } else {
         if ($field->isComponent()) {
             return sprintf("get_component('%s', '%s', array('type' => 'list', '%s' => \$%s))", $this->getModuleName(), $field->getName(), $this->getSingularName(), $this->getSingularName());
         } else {
             if ($field->isPartial()) {
                 return sprintf("get_partial('%s/%s', array('type' => 'list', '%s' => \$%s))", $this->getModuleName(), $field->getName(), $this->getSingularName(), $this->getSingularName());
             } else {
                 if ('Date' == $field->getType()) {
                     //            $html = sprintf("false !== strtotime($html) ? format_date(%s, \"%s\") : '&nbsp;'", $html, $field->getConfig('date_format', 'f'));
                 } else {
                     if ('Boolean' == $field->getType()) {
                         $html = sprintf("get_partial('%s/list_field_boolean', array('value' => %s))", $this->getModuleName(), $html);
                     }
                 }
             }
         }
     }
     if ($field->isLink()) {
         $html = sprintf("link_to(%s, '%s', \$%s)", $html, $this->getUrlForAction('edit'), $this->getSingularName());
     }
     return $html;
 }
 /**
  * Returns HTML code for a field.
  *
  * @param sfModelGeneratorConfigurationField $field The field
  *
  * @return string HTML code
  */
 public function renderField($field)
 {
     if ($field->isLink() && ($module = $field->getConfig('link_module', false, false))) {
         $field->setLink(false);
         $html = parent::renderField($field);
         $field->setLink(true);
         $html = sprintf("link_to(%s, '%s', %s)", $html, $module . '_edit', $html);
         return $html;
     } else {
         return parent::renderField($field);
     }
 }
 protected function compile()
 {
     $config = array('default' => $this->getFieldsDefault(), 'list' => $this->getFieldsList(), 'filter' => $this->getFieldsFilter(), 'form' => $this->getFieldsForm(), 'new' => $this->getFieldsNew(), 'edit' => $this->getFieldsEdit());
     // inheritance rules:
     // new|edit < form < default
     // list < default
     // filter < default
     $this->configuration = array('list' => array('fields' => array(), 'layout' => $this->getListLayout(), 'title' => $this->getListTitle(), 'actions' => $this->getListActions(), 'object_actions' => $this->getListObjectActions()), 'filter' => array('fields' => array()), 'form' => array('fields' => array()), 'new' => array('fields' => array(), 'title' => $this->getNewTitle(), 'actions' => $this->getNewActions() ? $this->getNewActions() : $this->getFormActions()), 'edit' => array('fields' => array(), 'title' => $this->getEditTitle(), 'actions' => $this->getEditActions() ? $this->getEditActions() : $this->getFormActions()));
     foreach (array_keys($config['default']) as $field) {
         $formConfig = array_merge($config['default'][$field], $config['form'][$field]);
         $this->configuration['list']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge($config['default'][$field], $config['list'][$field]));
         $this->configuration['filter']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge($config['default'][$field], $config['filter'][$field]));
         $this->configuration['form']['fields'][$field] = new sfModelGeneratorConfigurationField($field, $formConfig);
         $this->configuration['new']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge($formConfig, $config['new'][$field]));
         $this->configuration['edit']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge($formConfig, $config['edit'][$field]));
     }
     // form actions
     foreach (array('edit', 'new') as $context) {
         foreach ($this->configuration[$context]['actions'] as $action => &$parameters) {
             $this->fixActionParameters($action, $parameters);
         }
     }
     // list actions
     foreach ($this->configuration['list']['actions'] as $action => &$parameters) {
         $this->fixActionParameters($action, $parameters);
     }
     // list object actions
     foreach ($this->configuration['list']['object_actions'] as $action => &$parameters) {
         $this->fixActionParameters($action, $parameters);
     }
     // list field configuration
     $this->configuration['list']['display'] = array();
     foreach ($this->getListDisplay() as $name) {
         list($name, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
         if (!isset($this->configuration['list']['fields'][$name])) {
             $this->configuration['list']['fields'][$name] = new sfModelGeneratorConfigurationField($name, array_merge(array('is_real' => false, 'type' => 'Text'), isset($config['list'][$name]) ? $config['list'][$name] : array()));
         }
         $field = $this->configuration['list']['fields'][$name];
         $field->setFlag($flag);
         $this->configuration['list']['display'][$name] = $field;
     }
     // list params configuration
     $this->configuration['list']['params'] = $this->getListParams();
     preg_match_all('/%%([^%]+)%%/', $this->getListParams(), $matches, PREG_PATTERN_ORDER);
     foreach ($matches[1] as $name) {
         list($name, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
         if (!isset($this->configuration['list']['fields'][$name])) {
             throw new InvalidArgumentException(sprintf('The field "%s" does not exist.', $name));
         }
         $field = $this->configuration['list']['fields'][$name];
         $field->setFlag($flag);
         $this->configuration['list']['params'] = str_replace('%%' . $flag . $name . '%%', '%%' . $name . '%%', $this->configuration['list']['params']);
     }
     // filter field configuration
     $this->configuration['filter']['display'] = array();
     foreach ($this->getFilterDisplay() as $name) {
         list($name, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
         if (!isset($this->configuration['filter']['fields'][$name])) {
             throw new InvalidArgumentException(sprintf('The field "%s" does not exist.', $name));
         }
         $field = $this->configuration['filter']['fields'][$name];
         $field->setFlag($flag);
         $this->configuration['filter']['display'][$name] = $field;
     }
     // form field configuration
     foreach (array('edit', 'new') as $context) {
         $this->configuration[$context]['display'] = array();
         $method = sprintf('get%sDisplay', ucfirst($context));
         if (!($fieldsets = $this->{$method}())) {
             $fieldsets = $this->getFormDisplay();
         }
         foreach ($fieldsets as $fieldset => $names) {
             $this->configuration[$context]['display'][$fieldset] = array();
             foreach ($names as $name) {
                 list($name, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
                 if (!isset($this->configuration[$context]['fields'][$name])) {
                     throw new InvalidArgumentException(sprintf('The field "%s" does not exist.', $name));
                 }
                 $field = $this->configuration[$context]['fields'][$name];
                 $field->setFlag($flag);
                 $this->configuration[$context]['display'][$fieldset][$name] = $field;
             }
         }
     }
     // action credentials
     $this->configuration['credentials'] = array('list' => array(), 'new' => array(), 'create' => array(), 'edit' => array(), 'update' => array(), 'delete' => array());
     foreach ($this->getActionsDefault() as $action => $params) {
         if (0 === strpos($action, '_')) {
             $action = substr($action, 1);
         }
         $this->configuration['credentials'][$action] = isset($params['credentials']) ? $params['credentials'] : array();
     }
     $this->configuration['credentials']['create'] = $this->configuration['credentials']['new'];
     $this->configuration['credentials']['update'] = $this->configuration['credentials']['edit'];
 }
 /**
  * Returns HTML code for a field.
  *
  * @param sfModelGeneratorConfigurationField $field The field
  *
  * @return string HTML code
  */
 public function renderField($field)
 {
     $html = $this->getColumnGetter($field->getName(), true);
     if ($field->isComponent()) {
         return sprintf("get_component('%s', '%s', array('type' => 'list', '%s' => \$%s))", $this->getModuleName(), $field->getName(), $this->getSingularName(), $this->getSingularName());
     } else {
         if ($field->isPartial()) {
             return sprintf("get_partial('%s', array('type' => 'list', '%s' => \$%s))", $field->getName(), $this->getSingularName(), $this->getSingularName());
         } else {
             if ('Date' == $field->getType()) {
                 $html = sprintf("{$html} ? format_date(%s, \"%s\") : '&nbsp;'", $html, $field->getConfig('date_format', 'f'));
             } else {
                 if ('Boolean' == $field->getType()) {
                     $html = sprintf("get_partial('%s/list_field_boolean', array('value' => %s))", $this->getModuleName(), $html);
                 }
             }
         }
     }
     if ($field->isLink()) {
         $html = sprintf("link_to(%s, '%s', \$%s)", $html, $this->getUrlForAction('edit'), $this->getSingularName());
     }
     return $html;
 }
 * For the full copyright and license information, please generator the LICENSE
 * file that was distributed with this source code.
 */

require_once dirname(__FILE__).'/../../bootstrap/unit.php';

$t = new lime_test(12);

// ->isPartial() ->isComponent() ->isLink()
$t->diag('->isPartial() ->isComponent() ->isLink()');

$field = new sfModelGeneratorConfigurationField('my_field', array());
$t->is($field->isPartial(), false, '->isPartial() defaults to false');
$t->is($field->isComponent(), false, '->isComponent() defaults to false');
$t->is($field->isLink(), false, '->isLink() defaults to false');

$field = new sfModelGeneratorConfigurationField('my_field', array('flag' => '_'));
$t->is($field->isPartial(), true, '->isPartial() returns true if flag is "_"');
$t->is($field->isComponent(), false, '->isComponent() defaults to false');
$t->is($field->isLink(), false, '->isLink() defaults to false');

$field = new sfModelGeneratorConfigurationField('my_field', array('flag' => '~'));
$t->is($field->isPartial(), false, '->isPartial() defaults to false');
$t->is($field->isComponent(), true, '->isComponent() returns true if flag is "~"');
$t->is($field->isLink(), false, '->isLink() defaults to false');

$field = new sfModelGeneratorConfigurationField('my_field', array('flag' => '='));
$t->is($field->isPartial(), false, '->isPartial() defaults to false');
$t->is($field->isComponent(), false, '->isComponent() defaults to false');
$t->is($field->isLink(), true, '->isLink() returns true if flag is "="');
 /**
  * Renders the value of an admin-generator field in function of its type. This function is 
  * meant to render a "show" representation of a form field.
  * 
  * @param sfFormField $field: form field to render
  * @param mixed $value: the value to render
  * @return string 
  */
 public static function renderAdminFieldValue(sfForm $form, sfModelGeneratorConfigurationField $field, $value = null)
 {
     if (null === $value) {
         return '';
     }
     if ($renderer = $field->getRenderer()) {
         return call_user_func_array($renderer, array_merge(array($value), $field->getRendererArguments()));
     }
     $string = self::renderField($form, $field, $value, $field->getType());
     return $string;
 }
 public function isReal()
 {
     return parent::isReal() or isset($this->config['column_name']);
 }
 public function getFormFields(sfForm $form, $context)
 {
     $config = $this->getConfig();
     $overloaded = false;
     $specific_method = sprintf('get%sDisplay', ucfirst($context));
     $general_method = 'getFormFieldsDisplay';
     $method = method_exists($form, $specific_method) ? $specific_method : (method_exists($form, $general_method) ? $general_method : null);
     if (!is_null($method)) {
         $fieldsets = $form->{$method}();
         $overloaded = true;
     } elseif (!($fieldsets = $this->{$specific_method}())) {
         $fieldsets = $this->getFormDisplay();
     }
     if ($fieldsets && !$overloaded || isset($fieldsets) && $overloaded) {
         $fields = array();
         // with fieldsets?
         if (!is_array(reset($fieldsets))) {
             $fieldsets = array('NONE' => $fieldsets);
         }
         foreach ($fieldsets as $fieldset => $names) {
             if (!$names) {
                 continue;
             }
             $fields[$fieldset] = array();
             foreach ($names as $name) {
                 list($name, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
                 if (!isset($this->configuration[$context]['fields'][$name])) {
                     $this->configuration[$context]['fields'][$name] = new sfModelGeneratorConfigurationField($name, array_merge(isset($config['default'][$name]) ? $config['default'][$name] : array(), isset($config['form'][$name]) ? $config['form'][$name] : array(), isset($config[$context][$name]) ? $config[$context][$name] : array(), array('is_real' => false, 'type' => 'Text', 'flag' => $flag)));
                 }
                 $field = $this->configuration[$context]['fields'][$name];
                 $field->setFlag($flag);
                 $fields[$fieldset][$name] = $field;
             }
         }
         return $fields;
     }
     $fields = array();
     foreach ($form->getWidgetSchema()->getPositions() as $name) {
         $fields[$name] = new sfModelGeneratorConfigurationField($name, array_merge(array('type' => 'Text'), isset($config['default'][$name]) ? $config['default'][$name] : array(), isset($config['form'][$name]) ? $config['form'][$name] : array(), isset($config[$context][$name]) ? $config[$context][$name] : array(), array('is_real' => false)));
     }
     return array('NONE' => $fields);
 }