<commit_before><?php

namespace Oro\Bundle\FormBundle\Form\Extension;

use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

use Oro\Bundle\FormBundle\Form\Extension\Traits\FormExtendedTypeTrait;

class SortableExtension extends AbstractTypeExtension
{
    use FormExtendedTypeTrait;

    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (!$options['sortable']) {
            return;
        }

        $builder->add('_position', 'hidden', [
            'property_path' => $options['sortable_property_path'],
            'block_name' => 'hidden',
            'empty_data' => '0',
            'attr' => [
                'class' => 'position-input',
            ],
        ]);
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults([
            'sortable' => false,
            'sortable_property_path' => 'position',
        ]);
    }
}<commit_msg>BB-8046: Review and merge  - cr fixes<commit_after><?php

namespace Oro\Bundle\FormBundle\Form\Extension;

use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

use Oro\Bundle\FormBundle\Form\Extension\Traits\FormExtendedTypeTrait;

class SortableExtension extends AbstractTypeExtension
{
    use FormExtendedTypeTrait;

    const POSITION_FIELD_NAME = '_position';

    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (!$options['sortable']) {
            return;
        }

        $builder->add(self::POSITION_FIELD_NAME, 'hidden', [
            'property_path' => $options['sortable_property_path'],
            'block_name' => 'hidden',
            'empty_data' => '0',
            'attr' => [
                'class' => 'position-input',
            ],
        ]);
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults([
            'sortable' => false,
            'sortable_property_path' => 'position',
        ]);
    }
}
{'fraction_non_alphanumeric': 0.11953931691818905, 'fraction_numerical': 0.0023828435266084196, 'mean_word_length': 2.656023222060958, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '6986393', 'n_tokens_mistral': 704, 'n_tokens_neox': 687, 'n_words': 118}