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

CommentFileSizeAuthor
#8 viewsfieldtemplate-missing-types.patch1.24 KBAnonymous (not verified)

Comments

nodecode created an issue. See original summary.

neslee canil pinto’s picture

Status: Active » Closed (works as designed)
Anonymous’s picture

I 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.

Anonymous’s picture

Status: Closed (works as designed) » Active
nodecode’s picture

I 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.

u.kurilla’s picture

Confirmation like #5:
PHP 7.0.33, Drupal 8.8.5
#3 worked. Thx imonemus for finding+sharing

grincon’s picture

#3 worked for me too.
PHP 7.1.32 Core: 8.8.5

Anonymous’s picture

StatusFileSize
new1.24 KB

Thanks for the feedback. I've made a patch with those changes. Apologies in advance if I didn't follow the procedure correctly.

matija5’s picture

Status: Active » Reviewed & tested by the community

Hi, 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.

Anonymous’s picture

Great. 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.

matija5’s picture

I checked patch against latest Calendar dev version. I had problems in relation with another module, views_templates.

neslee canil pinto’s picture

Status: Reviewed & tested by the community » Fixed

Commited to dev branch

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.