1 | <?php |
||
27 | class EmailShareButtonBlockService extends BaseBlockService |
||
28 | { |
||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | public function configureSettings(OptionsResolver $resolver) |
||
33 | { |
||
34 | $resolver->setDefaults(array( |
||
35 | 'template' => 'SonataSeoBundle:Block:block_email_share_button.html.twig', |
||
36 | 'subject' => null, |
||
37 | 'body' => null, |
||
38 | )); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public function buildEditForm(FormMapper $formMapper, BlockInterface $block) |
||
45 | { |
||
46 | $formMapper->add('settings', 'sonata_type_immutable_array', array( |
||
47 | 'keys' => array( |
||
48 | array('subject', 'text', array( |
||
49 | 'required' => false, |
||
50 | 'label' => 'form.label_subject', |
||
51 | )), |
||
52 | array('body', 'text', array( |
||
53 | 'required' => false, |
||
54 | 'label' => 'form.label_body', |
||
55 | )), |
||
56 | ), |
||
57 | 'translation_domain' => 'SonataSeoBundle', |
||
58 | )); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | public function execute(BlockContextInterface $blockContext, Response $response = null) |
||
65 | { |
||
66 | $block = $blockContext->getBlock(); |
||
67 | $settings = array_merge($blockContext->getSettings(), $block->getSettings()); |
||
68 | |||
69 | return $this->renderResponse($blockContext->getTemplate(), array( |
||
70 | 'block' => $blockContext->getBlock(), |
||
71 | 'settings' => $settings, |
||
72 | ), $response); |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | public function getBlockMetadata($code = null) |
||
84 | } |
||
85 |