I created a flag based on a simple custom content_type, created a new view with a page.
I added a view field "Flagging : Flag Link"
This error shows when I want to display the page containing this view
( ! ) Fatal error: Call to a member function getLinkTypePlugin() on null in drupal8\modules\flag\src\Plugin\views\field\FlagViewsLinkField.php on line 100
protected function renderLink(EntityInterface $entity, ResultRow $values) {
if (empty($entity)) {
return '';
}
$flag = $this->getFlag();
$link_type_plugin = $flag->getLinkTypePlugin(); <----- line 100
$link = $link_type_plugin->getLink($flag, $entity);
return $link;
}
public function getFlag() {
if (isset($this->view->relationship[$this->options['relationship']])) {
return $this->view->relationship[$this->options['relationship']]->getFlag();
}
return NULL;
}
getFlag() seems to return NULL, a problem with a relationship somewhere ?
Comments
Comment #2
YoyoS commentedComment #3
YoyoS commentedComment #4
YoyoS commentedI made a patch, It may not be the right solution but it works.
If someone wants to correct it and explains me how to make a good patch following the right Drupal patterns, I would love it :)
Comment #5
YoyoS commentedComment #6
joachim commentedCan you explain how you built your view?
Comment #7
YoyoS commentedI first created a "Content" Flag => "fr/admin/structure/flags/add" And Selected my Flaggable Type which is a new Content Type created before. I didn't checked or changed anything except I have checked the "Display link as field"
Then I simply created a view with Display: Flagging and selected my new flag.
I checked "Create a page" with a custom alias and a pager.
Does this help ?
Comment #8
joachim commentedAh yup, the flag link field is only meant to go on a relationship. So your view ought to be of nodes, with a relationship to the flag you want.
We still haven't got round to allowing views with the Flagging table as the base on D7.
Comment #9
YoyoS commentedThanks. I was doing it wrong.
Comment #10
ivnish8 years without any activity. I think we can close it as outdated. Please reopen if needed.
Comment #11
ivnish