Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
562 views
in Themes by
edited by

I want to move the bookmark icon as below:

But when I do this, I get the following message:

my code:

public function q_view_stats($q_view)
{
    $this->output('<div class="qa-q-view-stats">');
    $this->voting($q_view);
    $this->a_count($q_view);
    $this->favorite(); 
    parent::view_count($q_view);
    $this->output('</div>');
}

Thank you for your guidance

Q2A version: 1.8
by
+1
When you do ... what exactly? The fav star is located in a span in the qa-main-heading div. For putting it below the voting box you'd have to put it in an entirely different structural element of the page (e.g. the qa-q-view-stats div), which would require overriding the respective methods of the qa_html_theme_base class in your theme.
by
Thankful
Yes, I exactly want to put the icon in qa-q-view-stats. I also overridden the corresponding method and placed the icon, but again, the same message was displayed for me.
I edited the question and put the code

1 Answer

+2 votes
by
selected by
 
Best answer

Inputs must be part of forms. Forms can include hidden fields. There is a code hidden field used for CSRF protection. The code used in the favoriting form is different from the code used in the main form.

Follow this high-level steps:

  1. Restructure your code so that you can output a form for the favoriting button and include the favoriting button. You can mainly get that from function page_title_error(). So you will have something like
    1. Open form
    2. favorite()
    3. Add favorite form hidden fields
    4. Close form
  2. Add that code wherever you want BUT make sure you are not nesting form elements. You can fix positioning with CSS
  3. Make sure you are not showing two favorite buttons in the same page as they use a unique ID
by
Thank you very much for the valuable advice
...