42 lines
948 B
Plaintext
42 lines
948 B
Plaintext
|
<?php
|
|||
|
|
|||
|
namespace Trinity\Bundle\ContentManagerBundle\Form\Type;
|
|||
|
|
|||
|
use Symfony\Component\Form\FormBuilderInterface;
|
|||
|
use Trinity\Component\Form\EventListener\FileDeleteFormListener;
|
|||
|
|
|||
|
class FileImageBlockType extends BlockType
|
|||
|
{
|
|||
|
protected $options = array(
|
|||
|
'data_class' => 'Trinity\Bundle\ContentManagerBundle\Block\FileBlock',
|
|||
|
);
|
|||
|
|
|||
|
/**
|
|||
|
* {@inheritdoc}
|
|||
|
*/
|
|||
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|||
|
{
|
|||
|
$builder->add(
|
|||
|
'value',
|
|||
|
'file',
|
|||
|
array(
|
|||
|
'data_class' => null,
|
|||
|
'attr' => array(
|
|||
|
'upload_dir' => 'uploads/slots'
|
|||
|
)
|
|||
|
)
|
|||
|
);
|
|||
|
|
|||
|
$builder->addEventSubscriber(new FileDeleteFormListener($builder->getFormFactory(), array('value')));
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* {@inheritdoc}
|
|||
|
*/
|
|||
|
public function getName()
|
|||
|
{
|
|||
|
return 'file_image_block';
|
|||
|
}
|
|||
|
|
|||
|
}
|