<commit_before><?php

/**
 * PlugingjDesignElement form.
 *
 * @package    ##PROJECT_NAME##
 * @subpackage form
 * @author     ##AUTHOR_NAME##
 * @version    SVN: $Id: sfDoctrineFormPluginTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class gjDesignElementPositionsForm extends PlugingjDesignElementForm
{
  public function configure()
  {
    $this->widgetSchema['position'] = new sfWidgetFormInputHidden();
    $this->widgetSchema['name']     = new sfWidgetFormInputHidden();

    $this->useFields(array('position', 'name'));

    $this->embedDynamicRelation('Contents', 'gjContentElementPositionsForm');
    $this->widgetSchema['contents']->addFormFormatter('container', new gjWidgetFormSchemaFormatterContentElementContainer($this->widgetSchema));
    $this->widgetSchema['contents']->setFormFormatterName('container');
    //$this->widgetSchema['contents']->setFormFormatterName('positions');
    $this->validatorSchema['contents']->setOption('allow_extra_fields', true);

    $this->getWidgetSchema()->addFormFormatter('design_element', new gjWidgetFormSchemaFormatterDesignElement($this->getWidgetSchema()));
    $this->widgetSchema->setFormFormatterName('design_element');
  }
}
<commit_msg>* design element form now uses the params field as configured in app.yml<commit_after><?php

/**
 * PlugingjDesignElement form.
 *
 * @package    ##PROJECT_NAME##
 * @subpackage form
 * @author     ##AUTHOR_NAME##
 * @version    SVN: $Id: sfDoctrineFormPluginTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class gjDesignElementPositionsForm extends PlugingjDesignElementForm
{
  public function configure()
  {
    $this->widgetSchema['position'] = new sfWidgetFormInputHidden();
    $this->widgetSchema['name']     = new sfWidgetFormInputHidden();

    $this->useFields(array('position', 'name'));

    $this->embedDynamicRelation('Contents', 'gjContentElementPositionsForm');
    $this->widgetSchema['contents']->addFormFormatter('container', new gjWidgetFormSchemaFormatterContentElementContainer($this->widgetSchema));
    $this->widgetSchema['contents']->setFormFormatterName('container');
    //$this->widgetSchema['contents']->setFormFormatterName('positions');
    $this->validatorSchema['contents']->setOption('allow_extra_fields', true);

    $this->getWidgetSchema()->addFormFormatter('design_element', new gjWidgetFormSchemaFormatterDesignElement($this->getWidgetSchema()));
    $this->widgetSchema->setFormFormatterName('design_element');

    $this->widgetSchema['params'] = new sfWidgetFormInputArray(array('config' => $this->getConfigForParams()));
  }

  protected function getConfigForParams()
  {
    $name = $this->getObject()->name;
    $config = sfConfig::get('app_gjPositionsPlugin_design_elements', array());

    if(empty($name) || !array_key_exists($name, $config) || empty($config[$name]['params']))
    {
      return array();
    }
    else
    {
      return $config[$name]['params'];
    }
  }
}

{'fraction_non_alphanumeric': 0.15673662830060933, 'fraction_numerical': 0.012863913337846988, 'mean_word_length': 5.96933962264151, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 44, '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': '133756', 'n_tokens_mistral': 880, 'n_tokens_neox': 831, 'n_words': 123}