Advertisement
amonoxia

node--answers-question.tpl.php

Aug 18th, 2017
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.50 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * @file
  5. * Theme an answers_question node
  6. * Customizations for FosterClub by Christia 2017.
  7. *
  8. * Available variables:
  9. * - $title: the (sanitized) title of the node.
  10. * - $content: An array of node items. Use render($content) to print them all,
  11. * or print a subset such as render($content['field_example']). Use
  12. * hide($content['field_example']) to temporarily suppress the printing of a
  13. * given element.
  14. * - $user_picture: The node author's picture from user-picture.tpl.php.
  15. * - $date: Formatted creation date. Preprocess functions can reformat it by
  16. * calling format_date() with the desired parameters on the $created variable.
  17. * - $name: Themed username of node author output from theme_username().
  18. * - $node_url: Direct url of the current node.
  19. * - $display_submitted: Whether submission information should be displayed.
  20. * - $submitted: Submission information created from $name and $date during
  21. * template_preprocess_node().
  22. * - $classes: String of classes that can be used to style contextually through
  23. * CSS. It can be manipulated through the variable $classes_array from
  24. * preprocess functions. The default values can be one or more of the
  25. * following:
  26. * - node: The current template type, i.e., "theming hook".
  27. * - node-[type]: The current node type. For example, if the node is a
  28. * "Blog entry" it would result in "node-blog". Note that the machine
  29. * name will often be in a short form of the human readable label.
  30. * - node-teaser: Nodes in teaser form.
  31. * - node-preview: Nodes in preview mode.
  32. * The following are controlled through the node publishing options.
  33. * - node-promoted: Nodes promoted to the front page.
  34. * - node-sticky: Nodes ordered above other non-sticky nodes in teaser
  35. * listings.
  36. * - node-unpublished: Unpublished nodes visible only to administrators.
  37. * - $title_prefix (array): An array containing additional output populated by
  38. * modules, intended to be displayed in front of the main title tag that
  39. * appears in the template.
  40. * - $title_suffix (array): An array containing additional output populated by
  41. * modules, intended to be displayed after the main title tag that appears in
  42. * the template.
  43. *
  44. * Other variables:
  45. * - $node: Full node object. Contains data that may not be safe.
  46. * - $type: Node type, i.e. story, page, blog, etc.
  47. * - $comment_count: Number of comments attached to the node.
  48. * - $uid: User ID of the node author.
  49. * - $created: Time the node was published formatted in Unix timestamp.
  50. * - $classes_array: Array of html class attribute values. It is flattened
  51. * into a string within the variable $classes.
  52. * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in
  53. * teaser listings.
  54. * - $id: Position of the node. Increments each time it's output.
  55. *
  56. * Node status variables:
  57. * - $view_mode: View mode, e.g. 'full', 'teaser'...
  58. * - $teaser: Flag for the teaser state (shortcut for $view_mode == 'teaser').
  59. * - $page: Flag for the full page state.
  60. * - $promote: Flag for front page promotion state.
  61. * - $sticky: Flags for sticky post setting.
  62. * - $status: Flag for published status.
  63. * - $comment: State of comment settings for the node.
  64. * - $readmore: Flags true if the teaser content of the node cannot hold the
  65. * main body content.
  66. * - $is_front: Flags true when presented in the front page.
  67. * - $logged_in: Flags true when the current user is a logged-in member.
  68. * - $is_admin: Flags true when the current user is an administrator.
  69. *
  70. * Field variables: for each field instance attached to the node a corresponding
  71. * variable is defined, e.g. $node->body becomes $body. When needing to access
  72. * a field's raw values, developers/themers are strongly encouraged to use these
  73. * variables. Otherwise they will have to explicitly specify the desired field
  74. * language, e.g. $node->body['en'], thus overriding any language negotiation
  75. * rule that was previously applied.
  76. *
  77. * @see template_preprocess()
  78. * @see template_preprocess_node()
  79. * @see template_process()
  80. */
  81. ?>
  82.  
  83. <?php
  84. // Remove the "Add new comment" link on the teaser page or if the comment
  85. unset($content['links']['comment']['#links']['comment-add']);
  86. ?>
  87.  
  88. <?php
  89.  
  90. // Hide these items to render when we choose.
  91. hide($content['links']['statistics']);
  92. hide($content['comments']);
  93. hide($content['links']);
  94. hide($content['best_answer']);
  95. hide($content['answers_list']);
  96. hide($content['new_answer_form']);
  97. hide($content['answersRateWidget']);
  98. ?>
  99.  
  100. <div class="node-answers-wrapper">
  101. <div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix" <?php print $attributes; ?>>
  102. <?php print render($title_prefix); ?>
  103. <?php if (!$page): ?>
  104. <h2<?php print $title_attributes; ?>>
  105. <a href="<?php print $node_url; ?>"><?php print $title; ?></a>
  106. </h2>
  107. <?php endif; ?>
  108. <?php print render($title_suffix); ?>
  109. <div class="answers-body-wrapper">
  110. <div class="answers-body">
  111. <div class="content clearfix" <?php print $content_attributes; ?>>
  112. <?php print render($content); ?>
  113. <h3><?php print $title; ?></h3>
  114. <div class="answers-submitted">
  115. <?php print $user_picture; ?>
  116. <?php
  117. $custom_date = format_date($node->created, 'custom', 'M d, Y');
  118. print t('Asked by ') . $name . ' &#8212 ' . $custom_date;
  119. ?>
  120. </div>
  121. <div>
  122. <div class="answer-button">
  123. <?php if (user_access('create answers_answer content')) {
  124. // Show answer button if user has privilege
  125. print '<a id="btn btn-lg btn-default" class="btn btn-lg btn-default" href="#new-answer-form">Answer</a>';
  126. }
  127. ?>
  128. </div>
  129. </div>
  130. </div>
  131. <div class="answers-body-toolbar">
  132. <?php
  133. $links = render($content['links']);
  134. if ($links):
  135. ?>
  136. <div class="link-wrapper">
  137. <?php
  138. print $links;
  139. ?>
  140. </div>
  141. <?php endif; ?>
  142. </div>
  143. <?php print render($content['comments']); ?>
  144. </div>
  145. </div>
  146.  
  147. <?php if(isset($content['answers_list'])): ?>
  148. <div class="answers-list">
  149. <?php print render($content['answers_list']); ?>
  150. </div>
  151. <?php endif;?>
  152.  
  153. <?php if(isset($content['new_answer_form'])): ?>
  154. <div id="new-answer-form">
  155. <?php print render($content['new_answer_form']); ?>
  156. </div>
  157. <?php endif;?>
  158. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement