<commit_before><?php

namespace Enhavo\Bundle\AppBundle\Column;

use Enhavo\Bundle\AppBundle\Type\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;

abstract class AbstractColumnType extends AbstractType implements ColumnTypeInterface
{
    public function createResourceViewData(array $options, $resource)
    {
        return null;
    }

    public function createColumnViewData(array $options)
    {
        $data = [
            'label' => $this->getLabel($options),
            'width' => $this->getWidth($options),
            'component' => $options['component'],
            'sortable' => isset($options['sortable']) ? $options['sortable'] : false,
        ];

        return $data;
    }

    /**
     * @inheritdoc
     */
    protected function getLabel($options)
    {
        $translator = $this->container->get('translator');
        return $translator->trans($options['label'], [], $options['translation_domain']);
    }

    /**
     * @inheritdoc
     */
    protected function getWidth($options)
    {
        return $options['width'];
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'label' => '',
            'translation_domain' => null,
            'width' => 1,
            'sortable' => false
        ]);
    }
}<commit_msg>add column conditional rendering<commit_after><?php

namespace Enhavo\Bundle\AppBundle\Column;

use Enhavo\Bundle\AppBundle\Type\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;

abstract class AbstractColumnType extends AbstractType implements ColumnTypeInterface
{
    public function createResourceViewData(array $options, $resource)
    {
        return null;
    }

    public function createColumnViewData(array $options)
    {
        $data = [
            'label' => $this->getLabel($options),
            'width' => $this->getWidth($options),
            'component' => $options['component'],
            'sortable' => isset($options['sortable']) ? $options['sortable'] : false,
            'condition' => $options['condition'],
        ];

        return $data;
    }

    /**
     * @inheritdoc
     */
    protected function getLabel($options)
    {
        $translator = $this->container->get('translator');
        return $translator->trans($options['label'], [], $options['translation_domain']);
    }

    /**
     * @inheritdoc
     */
    protected function getWidth($options)
    {
        return $options['width'];
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'label' => '',
            'translation_domain' => null,
            'width' => 1,
            'sortable' => false,
            'condition' => null
        ]);
    }
}
{'fraction_non_alphanumeric': 0.13962670495333812, 'fraction_numerical': 0.0007178750897343862, 'mean_word_length': 2.48375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '2734974', 'n_tokens_mistral': 754, 'n_tokens_neox': 743, 'n_words': 137}