<commit_before><?php

/**
 * PluginContent form.
 *
 * @package    form
 * @subpackage sfSympalContent
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 6174 2007-11-27 06:22:40Z jwage $
 */
abstract class PluginsfSympalContentForm extends BasesfSympalContentForm
{
  public function setup()
  {
    parent::setup();

    $this->validatorSchema->setOption('allow_extra_fields', true);

    unset(
      $this['site_id'],
      $this['created_at'],
      $this['updated_at'],
      $this['last_updated_by_id']
    );

    sfSympalFormToolkit::embedRichDateWidget('date_published', $this);

    $q = Doctrine_Query::create()
      ->from('sfSympalMenuItem m')
      ->orderBy('m.root_id, m.lft ASC');

    if (sfSympalConfig::isI18nEnabled('sfSympalMenuItem'))
    {
      $q->leftJoin('m.Translation mt'); 
    }

    sfSympalFormToolkit::changeLayoutWidget($this);

    if (!$this->object->content_type_id)
    {
      $this->object->Type = Doctrine_Core::getTable('sfSympalContentType')->findOneBySlug('page');
    } else {
      $this->object->Type;
    }

    $this->_embedTypeForm();
  }

  protected function _embedTypeForm()
  {
    $typeModelClass = $this->object->Type->name ? $this->object->Type->name:'sfSympalPage';
    $typeFormClass = $typeModelClass . 'Form';

    $record = $this->object->getRecord();
    $record->mapValue('contentForm', $this);
    $typeForm = new $typeFormClass($record);

    unset($typeForm['id'], $typeForm['content_id']);

    if (count($typeForm))
    {
      $this->embedForm('TypeForm', $typeForm);
      $this->widgetSchema['TypeForm']->setLabel($this->object->Type->label);
    }
  }
}<commit_msg>[1.4][sfSympalPlugin][1.0] Unsetting unused fields from content form<commit_after><?php

/**
 * PluginContent form.
 *
 * @package    form
 * @subpackage sfSympalContent
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 6174 2007-11-27 06:22:40Z jwage $
 */
abstract class PluginsfSympalContentForm extends BasesfSympalContentForm
{
  public function setup()
  {
    parent::setup();

    $this->validatorSchema->setOption('allow_extra_fields', true);

    unset(
      $this['site_id'],
      $this['created_at'],
      $this['updated_at'],
      $this['last_updated_by_id'],
      $this['slots_list'],
      $this['links_list'],
      $this['assets_list']
    );

    sfSympalFormToolkit::embedRichDateWidget('date_published', $this);

    $q = Doctrine_Query::create()
      ->from('sfSympalMenuItem m')
      ->orderBy('m.root_id, m.lft ASC');

    if (sfSympalConfig::isI18nEnabled('sfSympalMenuItem'))
    {
      $q->leftJoin('m.Translation mt'); 
    }

    sfSympalFormToolkit::changeLayoutWidget($this);

    if (!$this->object->content_type_id)
    {
      $this->object->Type = Doctrine_Core::getTable('sfSympalContentType')->findOneBySlug('page');
    } else {
      $this->object->Type;
    }

    $this->_embedTypeForm();
  }

  protected function _embedTypeForm()
  {
    $typeModelClass = $this->object->Type->name ? $this->object->Type->name:'sfSympalPage';
    $typeFormClass = $typeModelClass . 'Form';

    $record = $this->object->getRecord();
    $record->mapValue('contentForm', $this);
    $typeForm = new $typeFormClass($record);

    unset($typeForm['id'], $typeForm['content_id']);

    if (count($typeForm))
    {
      $this->embedForm('TypeForm', $typeForm);
      $this->widgetSchema['TypeForm']->setLabel($this->object->Type->label);
    }
  }
}
{'fraction_non_alphanumeric': 0.17353198948290974, 'fraction_numerical': 0.012854221443178498, 'mean_word_length': 3.782122905027933, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6435205', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1134, 'n_words': 159}