CMTV
Well-known member
Hello!
First of all, I have to say that it is really hard for my to get into all this xF core and addon structure, relations, models and etc. but I am trying my best to understand this. I used to create Wordpress plugins before and that process was fairly easy. So, let's get to the point.
I am trying to create an addon wich allow users to create question-threads. These threads are just like the old ones but they can be solved or not solved (by default). From official dev tutorial I created a new column in
... and did all other steps. Although I am not sure I understand everything that is written in dev tutorial, I can create question-threads.
Now the only thing I need to do is to add a button "Mark as solved" in
How can I create such a button (what to write in
First of all, I have to say that it is really hard for my to get into all this xF core and addon structure, relations, models and etc. but I am trying my best to understand this. I used to create Wordpress plugins before and that process was fairly easy. So, let's get to the point.
I am trying to create an addon wich allow users to create question-threads. These threads are just like the old ones but they can be solved or not solved (by default). From official dev tutorial I created a new column in
xf_thread
called questionthreads__is_question
. I also created a table xf_questionthreads_thread
which has 3 columns: thread_id
, is_solved
and best_post_id
. I extended thread entity structure so it now knows about questionthreads__is_question
column:
PHP:
public static function threadEntityStructure(\XF\Mvc\Entity\Manager $em, \XF\Mvc\Entity\Structure &$structure) {
$structure->columns['questionthreads__is_question'] = ['type' => Entity::BOOL, 'default' => false];
$structure->relations['QuestionThread'] = [
'entity' => 'QuestionThreads:QuestionThread',
'type' => Entity::TO_ONE,
'conditions' => 'thread_id',
'primary' => true
];
}
Now the only thing I need to do is to add a button "Mark as solved" in
quick_reply_macros
template (or somewhere else). This button must somehow change the is_solved
column value from 0 to 1 for current thread. I am completely confused now in all this entities, routings, contorllers ans so on. I don't quite understand what steps should I perform now...How can I create such a button (what to write in
<xf:button ...
? How to change the column value?
Last edited: