This issue is present in both stable and dev. I've run update.php, cron, cleared all caches. Nothing works.
Steps to reproduce:
1. Install Calendar which installs Views Templates
2. Visit /admin/structure/views/
3. Click "Add view from template" which takes you to /admin/structure/views/template/list and results in a 500 error
The error is as follows:
PHP Fatal error: Declaration of Drupal\calendar\Plugin\ViewsTemplateBuilder\ViewsFieldTemplate::buildConfigurationForm($form, Drupal\Core\Form\FormStateInterface $form_state) must be compatible with Drupal\views_templates\Plugin\ViewsBuilderPluginInterface::buildConfigurationForm(array $form, Drupal\Core\Form\FormStateInterface $form_state) in /mywebsite/modules/contrib/calendar/src/Plugin/ViewsTemplateBuilder/ViewsFieldTemplate.php on line 21
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | viewsfieldtemplate-missing-types.patch | 1.24 KB | Anonymous (not verified) |
Comments
Comment #2
neslee canil pintoComment #3
Anonymous (not verified) commentedI don't know if this is a php version issue, but I had the same problem. To fix, in ViewsFieldTemplate.php, I changed:
public function buildConfigurationForm($form, FormStateInterface $form_state)
to
public function buildConfigurationForm(array $form, FormStateInterface $form_state)
I still got a warning and so also changed:
protected function alterViewTemplateAfterCreation(array &$view_template, $options = NULL)
to
protected function alterViewTemplateAfterCreation(array &$view_template, array $options = NULL)
That seems to clear up the incompatibility with the parent.
Comment #4
Anonymous (not verified) commentedComment #5
nodecode commentedI can confirm that the solution in #3 does indeed solve the problem. I edited the code and can now use Views Templates as expected. For reference, my current PHP version is 7.1.33, and this was tested with Drupal Core 8.8.4.
Comment #6
u.kurilla commentedConfirmation like #5:
PHP 7.0.33, Drupal 8.8.5
#3 worked. Thx imonemus for finding+sharing
Comment #7
grincon commented#3 worked for me too.
PHP 7.1.32 Core: 8.8.5
Comment #8
Anonymous (not verified) commentedThanks for the feedback. I've made a patch with those changes. Apologies in advance if I didn't follow the procedure correctly.
Comment #9
matija5 commentedHi, thanks for the patch.
At first applying this patch did not work for me.
I did some investigating and the issue was I had views_tempates module version 8.x-1.0-alpha1 installed (buildConfigurationForm method had $form as argument instead of array $form - as in the latest version).
After updating views_templates to latest version 8.x-1.1. the patch applied successfully.
Comment #10
Anonymous (not verified) commentedGreat. Thanks for testing. I was also using the alpha originally, but the procedure states the patch should be made against the latest dev version, which makes sense. So, yes, you need to upgrade to the latest dev first.
Comment #11
matija5 commentedI checked patch against latest Calendar dev version. I had problems in relation with another module, views_templates.
Comment #13
neslee canil pintoCommited to dev branch