diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme index 6245b4d..3815f13 100644 --- a/core/themes/bartik/bartik.theme +++ b/core/themes/bartik/bartik.theme @@ -78,7 +78,7 @@ function bartik_process_page(&$variables) { } /** - * Implements hook_preprocess_HOOK() for maintenance-page.tpl.php. + * Implements hook_preprocess_HOOK() for maintenance-page.html.twig. */ function bartik_preprocess_maintenance_page(&$variables) { // By default, site_name is set to Drupal if no db connection is available @@ -92,7 +92,7 @@ function bartik_preprocess_maintenance_page(&$variables) { } /** - * Implements hook_process_HOOK() for maintenance-page.tpl.php. + * Implements hook_process_HOOK() for maintenance-page.html.twig. */ function bartik_process_maintenance_page(&$variables) { $site_config = config('system.site'); @@ -111,6 +111,17 @@ function bartik_process_maintenance_page(&$variables) { } /** + * Implements hook_preprocess_HOOK() for node.html.twig. + */ +function bartik_preprocess_node(&$variables) { + // Remove the "Add new comment" link on teasers or when the comment form is + // displayed on the page. + if ($variables['teaser'] || !empty($variables['content']['comments']['comment_form'])) { + unset($variables['content']['links']['comment']['#links']['comment-add']); + } +} + +/** * Implements theme_menu_tree(). */ function bartik_menu_tree($variables) { diff --git a/core/themes/bartik/templates/comment-wrapper.tpl.php b/core/themes/bartik/templates/comment-wrapper.tpl.php deleted file mode 100644 index fd8dfa7..0000000 --- a/core/themes/bartik/templates/comment-wrapper.tpl.php +++ /dev/null @@ -1,48 +0,0 @@ - -
> - type != 'forum'): ?> - -

- - - - - - -

- - -
diff --git a/core/themes/bartik/templates/comment.html.twig b/core/themes/bartik/templates/comment.html.twig new file mode 100644 index 0000000..48fd391 --- /dev/null +++ b/core/themes/bartik/templates/comment.html.twig @@ -0,0 +1,130 @@ +{# +/** + * @file + * Bartik's theme implementation for comments. + * + * Available variables: + * - author: Comment author. Can be a link or plain text. + * - content: The content-related items for the comment display. Use + * {{ content }} to print them all, or print a subset such as + * {{ content.field_example }}. Use hide(content.field_example) to temporarily + * suppress the printing of a given element. + * - created: Formatted date and time for when the comment was created. + * Preprocess functions can reformat it by calling format_date() with the + * desired parameters on the 'comment.created' variable. + * - changed: Formatted date and time for when the comment was last changed. + * Preprocess functions can reformat it by calling format_date() with the + * desired parameters on the 'comment.changed' variable. + * - new: New comment marker. + * - permalink: Comment permalink. + * - submitted: Submission information created from author and created + * during template_preprocess_comment(). + * - user_picture: The comment author's profile picture. + * - signature: The comment author's signature. + * - status: Comment status. Possible values are: + * unpublished, published, or preview. + * - title: Comment title, linked to the comment. + * - attributes.class: List of classes that can be used to style contextually + * through CSS. The default values can be one or more of the following: + * - comment: The current template type; e.g., 'theming hook'. + * - by-anonymous: Comment by an unregistered user. + * - by-node-author: Comment by the author of the parent node. + * - preview: When previewing a new or edited comment. + * The following applies only to viewers who are registered users: + * - unpublished: An unpublished comment visible only to administrators. + * - by-viewer: Comment by the user currently viewing the page. + * - new: New comment since the last visit. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * - content_attributes: List of classes for the styling of the comment content. + * + * These variables are provided to give context about the parent comment (if + * any): + * - comment_parent: Full parent comment entity (if any). + * - parent_author: Equivalent to author for the parent comment. + * - parent_created: Equivalent to created for the parent comment. + * - parent_changed: Equivalent to changed for the parent comment. + * - parent_title: Equivalent to title for the parent comment. + * - parent_permalink: Equivalent to permalink for the parent comment. + * - parent: A text string of parent comment submission information created from + * 'parent_author' and 'parent_created' during template_preprocess_comment(). + * This information is presented to help screen readers follow lengthy + * discussion threads. You can hide this from sighted users using the class + * element-invisible. + * + * These two variables are provided for context: + * - comment: Full comment object. + * - node: Node entity the comments are attached to. + * + * @see template_preprocess() + * @see template_preprocess_comment() + * + * @ingroup themeable + */ +#} +
+ +
+ +
+ {{ user_picture }} + + +
+ +
+
+ + {% if new %} + {{ new }} + {% endif %} + + {{ title_prefix }} + {{ title }} + {{ title_suffix }} +
+ +
+ + + {# We hide the links now so that we can render them later. #} + {% hide(content.links) %} + {{ content }} + + + +
+ {% if signature %} +
+ {{ signature }} +
+ {% endif %} + + +
+ +
diff --git a/core/themes/bartik/templates/comment.tpl.php b/core/themes/bartik/templates/comment.tpl.php deleted file mode 100644 index a8c4924..0000000 --- a/core/themes/bartik/templates/comment.tpl.php +++ /dev/null @@ -1,135 +0,0 @@ -created variable. - * - $changed: Formatted date and time for when the comment was last changed. - * Preprocess functions can reformat it by calling format_date() with the - * desired parameters on the $comment->changed variable. - * - $new: New comment marker. - * - $permalink: Comment permalink. - * - $submitted: Submission information created from $author and $created - * during template_preprocess_comment(). - * - $signature: Authors signature. - * - $status: Comment status. Possible values are: - * unpublished, published, or preview. - * - $title: Linked title. - * - $attributes: An instance of Attributes class that can be manipulated as an - * array and printed as a string. - * It includes the 'class' information, which includes: - * - comment: The current template type; e.g., 'theming hook'. - * - by-anonymous: Comment by an unregistered user. - * - by-node-author: Comment by the author of the parent node. - * - preview: When previewing a new or edited comment. - * The following applies only to viewers who are registered users: - * - unpublished: An unpublished comment visible only to administrators. - * - by-viewer: Comment by the user currently viewing the page. - * - new: New comment since the last visit. - * - $title_prefix (array): An array containing additional output populated by - * modules, intended to be displayed in front of the main title tag that - * appears in the template. - * - $title_suffix (array): An array containing additional output populated by - * modules, intended to be displayed after the main title tag that appears in - * the template. - * - * These variables are provided to give context about the parent comment (if - * any): - * - $comment_parent: Full parent comment object (if any). - * - $parent_author: Equivalent to $author for the parent comment. - * - $parent_created: Equivalent to $created for the parent comment. - * - $parent_changed: Equivalent to $changed for the parent comment. - * - $parent_title: Equivalent to $title for the parent comment. - * - $parent_permalink: Equivalent to $permalink for the parent comment. - * - $parent: A text string of parent comment submission information created - * from $parent_author and $parent_created during - * template_preprocess_comment(). This information is presented to help - * screen readers follow lengthy discussion threads. You can hide this from - * sighted users using the class element-invisible. - * - * These two variables are provided for context: - * - $comment: Full comment object. - * - $node: Node entity the comments are attached to. - * - * @see template_preprocess() - * @see template_preprocess_comment() - * @see template_process() - * @see theme_comment() - * - * @ingroup themeable - */ -?> -
role="article"> - -
- -
- - - -
- -
-
- - - - - - - > - -
- -
- -
> - -
- - - -
diff --git a/core/themes/bartik/templates/maintenance-page.html.twig b/core/themes/bartik/templates/maintenance-page.html.twig new file mode 100644 index 0000000..2d49784 --- /dev/null +++ b/core/themes/bartik/templates/maintenance-page.html.twig @@ -0,0 +1,66 @@ +{# +/** + * @file + * Bartik's theme implementation to display a single Drupal page while offline. + * + * All of the available variables are mirrored in page.html.twig. + * + * @see template_preprocess() + * @see template_preprocess_maintenance_page() + * @see bartik_process_maintenance_page() + * + * @ingroup themeable + */ + #} + + + + {{ head }} + {{ head_title }} + {{ styles }} + {{ scripts }} + + + + + +
+ + + +
+
+ + {% if title %}

{{ title }}

{% endif %} + {{ content }} + {% if messages %} +
+ {{ messages }} +
+ {% endif %} +
+
+ +
+ + + diff --git a/core/themes/bartik/templates/maintenance-page.tpl.php b/core/themes/bartik/templates/maintenance-page.tpl.php deleted file mode 100644 index 8e56378..0000000 --- a/core/themes/bartik/templates/maintenance-page.tpl.php +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - <?php print $head_title; ?> - - - -> - - - -
- - - -
-
- -

- - -
- -
- -
-
- -
- - - diff --git a/core/themes/bartik/templates/node.html.twig b/core/themes/bartik/templates/node.html.twig new file mode 100644 index 0000000..68a4a93 --- /dev/null +++ b/core/themes/bartik/templates/node.html.twig @@ -0,0 +1,115 @@ +{# +/** + * @file + * Bartik's theme implementation to display a node. + * + * Available variables: + * - node: Full node entity. + * - type: The type of the node, for example, "page" or "article". + * - uid: The user ID of the node author. + * - created: Formatted creation date. Preprocess functions can reformat it by + * calling format_date() with the desired parameters on + * $variables['node']->created. + * - promote: Whether the node is promoted to the front page. + * - sticky: Whether the node is 'sticky'. Sticky nodes are ordered above + * other non-sticky nodes in teaser listings + * - status: Whether the node is published. + * - comment: A value representing the comment status of the current node. May + * be one of the following: + * - 0: The comment form and any existing comments are hidden. + * - 1: Comments are closed. No new comments may be posted, but existing + * comments are displayed. + * - 2: Comments are open on this node. + * - comment_count: Number of comments attached to the node. + * - label: The title of the node. + * - content: All node items. Use {{ content }} to print them all, + * or print a subset such as {{ content.field_example }}. Use + * {% hide(content.field_example) %} to temporarily suppress the printing + * of a given element. + * - user_picture: The node author's picture from user-picture.html.twig. + * - date: Formatted creation date. Preprocess functions can reformat it by + * calling format_date() with the desired parameters on + * $variables['created']. + * - name: Themed username of node author output from theme_username(). + * - node_url: Direct URL of the current node. + * - display_submitted: Whether submission information should be displayed. + * - submitted: Submission information created from name and date during + * template_preprocess_node(). + * - attributes: HTML attributes for the containing element. + * The attributes.class element may contain one or more of the following + * classes: + * - node: The current template type (also known as a "theming hook"). + * - node-[type]: The current node type. For example, if the node is a + * "Article" it would result in "node-article". Note that the machine + * name will often be in a short form of the human readable label. + * - view-mode-[view_mode]: The View Mode of the node; for example, a teaser + * would result in: "view-mode-teaser", and full: "view-mode-full". + * - preview: Whether a node is in preview mode. + * The following are controlled through the node publishing options. + * - promoted: Appears on nodes promoted to the front page. + * - sticky: Appears on nodes ordered above other non-sticky nodes in teaser + * listings. + * - unpublished: Appears on unpublished nodes visible only to site admins. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * - view_mode: View mode; for example, "teaser" or "full". + * - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'. + * - page: Flag for the full page state. Will be true if view_mode is 'full'. + * - readmore: Flag for more state. Will be true if the teaser content of the + * node cannot hold the main body content. + * - is_front: Flag for front. Will be true when presented on the front page. + * - logged_in: Flag for authenticated user status. Will be true when the + * current user is a logged-in member. + * - is_admin: Flag for admin user status. Will be true when the current user + * is an administrator. + * + * In field variables, each field instance attached to the node a corresponding + * variable is defined; for example, 'node.body' becomes 'body'. When needing to + * access a field's raw values, developers/themers are strongly encouraged to + * use these variables. Otherwise they will have to explicitly specify the + * desired field language; for example, 'node.body.en', thus overriding any + * language negotiation rule that may have been applied previously. + * + * @see template_preprocess() + * @see template_preprocess_node() + * + * @ingroup themeable + */ +#} +
+ +
+ {{ title_prefix }} + {% if not page %} + + {{ label }} + + {% endif %} + {{ title_suffix }} + + {% if display_submitted %} + + {% endif %} +
+ +
+ {# We hide the comments and links now so that we can render them later. #} + {% hide(content.comments) %} + {% hide(content.links) %} + {{ content }} +
+ + {% if content.links %} + + {% endif %} + + {{ content.comments }} + +
diff --git a/core/themes/bartik/templates/node.tpl.php b/core/themes/bartik/templates/node.tpl.php deleted file mode 100644 index eb5cf17..0000000 --- a/core/themes/bartik/templates/node.tpl.php +++ /dev/null @@ -1,121 +0,0 @@ -body becomes $body. - * When needing to access a field's raw values, developers/themers are strongly - * encouraged to use these variables. Otherwise they will have to explicitly - * specify the desired field language; for example, $node->body['en'], thus - * overriding any language negotiation rule that was previously applied. - * - * @see template_preprocess() - * @see template_preprocess_node() - * @see template_process() - * - * @ingroup themeable - */ -?> -
role="article"> - -
- - - > - - - - - - - - -
- -
> - -
- - - - - - - -