Earl
Well-known member
I have
Then again it calls
I don't know why these vote_count and vote_score fields are required, since those values also in the xf_content_vote XenForo built-in table, But I guess that's the correct procedure. (Please correct me if I'm wrong)
Here is where my problem comes.
I have this route setup
When I use this vote_control macro, it requires this arg-link so it can build the link to the content.
But it fails because this entity doesn't have the
But I do have
Suggestion entity only has a 'content_id' column which is a relation to XF:Thread entity.
My question is: Is having a getter for thread_id in $suggestion entity is the only way to build the link correctly? Isn't there a way to get the thread_id from the relation of the Suggestion entity, and build the link?
Please help
Actually, this whole question is about building links and routes, But I also have posted about this voting system because I haven't seen anyone have had to try to implement it yet. So this thread will help, and also if you spot I'm doing something wrong, please correct me.
vote_count
and vote_score
columns on my new suggestion entity's table which uses ContentVoteTrait;
.Then again it calls
static::addVotableStructureElements($structure);
from the inside ofpublic static function getStructure(Structure $structure){....}
I don't know why these vote_count and vote_score fields are required, since those values also in the xf_content_vote XenForo built-in table, But I guess that's the correct procedure. (Please correct me if I'm wrong)
Here is where my problem comes.
I have this route setup
When I use this vote_control macro, it requires this arg-link so it can build the link to the content.
HTML:
<span class="actionBar-action actionBar-action--vote">
<xf:macro template="content_vote_macros" name="vote_control"
arg-link="threads/community-suggestions"
arg-content="{$suggestion}"/>
</span>
thread_id
column. It builds this incorrect link: /index.php?threads/community-suggestion/1 (this link doesn't get built with the thread_id)But I do have
:+int<thread_id,title>
part in route format as you can see in the previous screenshot.Suggestion entity only has a 'content_id' column which is a relation to XF:Thread entity.
My question is: Is having a getter for thread_id in $suggestion entity is the only way to build the link correctly? Isn't there a way to get the thread_id from the relation of the Suggestion entity, and build the link?
Please help
Actually, this whole question is about building links and routes, But I also have posted about this voting system because I haven't seen anyone have had to try to implement it yet. So this thread will help, and also if you spot I'm doing something wrong, please correct me.
Last edited: