1 | <?php |
||
31 | class TwitterEmbedTweetBlockService extends BaseTwitterButtonBlockService |
||
32 | { |
||
33 | const TWITTER_OEMBED_URI = 'https://api.twitter.com/1/statuses/oembed.json'; |
||
34 | const TWEET_URL_PATTERN = '%^(https://)(www.)?(twitter.com/)(.*)(/status)(es)?(/)([0-9]*)$%i'; |
||
35 | const TWEET_ID_PATTERN = '%^([0-9]*)$%'; |
||
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | public function execute(BlockContextInterface $blockContext, Response $response = null) |
||
70 | |||
71 | /** |
||
72 | * {@inheritdoc} |
||
73 | */ |
||
74 | public function configureSettings(OptionsResolver $resolver) |
||
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | public function buildEditForm(FormMapper $form, BlockInterface $block) |
||
93 | { |
||
94 | $form->add('settings', 'sonata_type_immutable_array', array( |
||
95 | 'keys' => array( |
||
96 | array('tweet', 'textarea', array( |
||
97 | 'required' => true, |
||
98 | 'label' => 'form.label_tweet', |
||
99 | 'help_block' => 'form.help_tweet', |
||
100 | )), |
||
101 | array('maxwidth', 'integer', array( |
||
102 | 'required' => false, |
||
103 | 'label' => 'form.label_maxwidth', |
||
104 | 'help_block' => 'form.help_maxwidth', |
||
105 | )), |
||
106 | array('hide_media', 'checkbox', array( |
||
107 | 'required' => false, |
||
108 | 'label' => 'form.label_hide_media', |
||
109 | 'help_block' => 'form.help_hide_media', |
||
110 | )), |
||
111 | array('hide_thread', 'checkbox', array( |
||
112 | 'required' => false, |
||
113 | 'label' => 'form.label_hide_thread', |
||
114 | 'help_block' => 'form.help_hide_thread', |
||
115 | )), |
||
116 | array('omit_script', 'checkbox', array( |
||
117 | 'required' => false, |
||
118 | 'label' => 'form.label_omit_script', |
||
119 | 'help_block' => 'form.help_omit_script', |
||
120 | )), |
||
121 | array('align', 'choice', array( |
||
122 | 'required' => false, |
||
123 | 'choices' => array( |
||
124 | 'left' => 'form.label_align_left', |
||
125 | 'right' => 'form.label_align_right', |
||
126 | 'center' => 'form.label_align_center', |
||
127 | 'none' => 'form.label_align_none', |
||
128 | ), |
||
129 | 'label' => 'form.label_align', |
||
130 | )), |
||
131 | array('related', 'text', array( |
||
132 | 'required' => false, |
||
133 | 'label' => 'form.label_related', |
||
134 | 'help_block' => 'form.help_related', |
||
135 | )), |
||
136 | array('lang', 'choice', array( |
||
137 | 'required' => true, |
||
138 | 'choices' => $this->languageList, |
||
139 | 'label' => 'form.label_lang', |
||
140 | )), |
||
141 | ), |
||
142 | 'translation_domain' => 'SonataSeoBundle', |
||
143 | )); |
||
144 | } |
||
145 | |||
146 | /** |
||
147 | * {@inheritdoc} |
||
148 | */ |
||
149 | public function getBlockMetadata($code = null) |
||
150 | { |
||
151 | return new Metadata($this->getName(), (!is_null($code) ? $code : $this->getName()), false, 'SonataSeoBundle', array( |
||
152 | 'class' => 'fa fa-twitter', |
||
153 | )); |
||
154 | } |
||
155 | |||
156 | /** |
||
157 | * Returns supported API parameters from settings. |
||
158 | * |
||
159 | * @return array |
||
160 | */ |
||
161 | protected function getSupportedApiParams() |
||
175 | |||
176 | /** |
||
177 | * Builds the API query URI based on $settings. |
||
178 | * |
||
179 | * @param bool $uriMatched |
||
180 | * @param array $settings |
||
181 | * |
||
182 | * @return string |
||
183 | */ |
||
184 | protected function buildUri($uriMatched, array $settings) |
||
207 | } |
||
208 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: