Repository navigation
feat: comments-family renderer parity + CommentInliner + post-comments / pagination forks (#519 Pass 2) #525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ViewFromTheBox
merged 2 commits into
release/1.0
from
feature/519-fork-comments-family-blocks
Jun 3, 2026
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...-editor-renderer-blade/resources/views/blocks/artisanpack/comment-author-avatar.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\UrlSanitizer; | ||
|
|
||
| $url = UrlSanitizer::safe( isset( $attributes['_resolvedAvatarUrl'] ) && is_string( $attributes['_resolvedAvatarUrl'] ) ? $attributes['_resolvedAvatarUrl'] : '' ); | ||
| $alt = isset( $attributes['_resolvedAvatarAlt'] ) && is_string( $attributes['_resolvedAvatarAlt'] ) ? $attributes['_resolvedAvatarAlt'] : ''; | ||
|
|
||
| $width = isset( $attributes['width'] ) && is_numeric( $attributes['width'] ) ? (int) $attributes['width'] : 96; | ||
| $height = isset( $attributes['height'] ) && is_numeric( $attributes['height'] ) ? (int) $attributes['height'] : 96; | ||
| @endphp | ||
| <div{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comment-author-avatar' ] ) !!}> | ||
| @if ( '' !== $url ) | ||
| <img src="{{ $url }}" alt="{{ $alt }}" width="{{ $width }}" height="{{ $height }}" loading="lazy" /> | ||
| @endif | ||
| </div> |
22 changes: 22 additions & 0 deletions
22
...al-editor-renderer-blade/resources/views/blocks/artisanpack/comment-author-name.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\UrlSanitizer; | ||
|
|
||
| $isLink = ! empty( $attributes['isLink'] ); | ||
| $linkTarget = isset( $attributes['linkTarget'] ) && is_string( $attributes['linkTarget'] ) ? $attributes['linkTarget'] : '_self'; | ||
|
|
||
| $name = isset( $attributes['_resolvedAuthorName'] ) && is_string( $attributes['_resolvedAuthorName'] ) ? $attributes['_resolvedAuthorName'] : ''; | ||
| $authorUrl = UrlSanitizer::safe( isset( $attributes['_resolvedAuthorUrl'] ) && is_string( $attributes['_resolvedAuthorUrl'] ) ? $attributes['_resolvedAuthorUrl'] : '' ); | ||
|
|
||
| $linkAttrs = 'href="' . e( $authorUrl ) . '"'; | ||
| if ( '_blank' === $linkTarget ) { | ||
| $linkAttrs .= ' target="_blank" rel="noopener noreferrer"'; | ||
| } | ||
| @endphp | ||
| <div{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comment-author-name' ] ) !!}> | ||
| @if ( $isLink && '' !== $authorUrl ) | ||
| <a {!! $linkAttrs !!}>{{ $name }}</a> | ||
| @else | ||
| {{ $name }} | ||
| @endif | ||
| </div> |
14 changes: 14 additions & 0 deletions
14
...visual-editor-renderer-blade/resources/views/blocks/artisanpack/comment-content.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
|
|
||
| $content = isset( $attributes['_resolvedContent'] ) && is_string( $attributes['_resolvedContent'] ) ? $attributes['_resolvedContent'] : ''; | ||
| $align = isset( $attributes['textAlign'] ) && is_string( $attributes['textAlign'] ) ? $attributes['textAlign'] : ''; | ||
|
|
||
| $classes = [ 'wp-block-comment-content' ]; | ||
| if ( '' !== $align ) { | ||
| $classes[] = 'has-text-align-' . $align; | ||
| } | ||
| @endphp | ||
| <div{!! BlockSupports::wrapperAttrs( $attributes, $classes ) !!}> | ||
| {!! $content !!} | ||
| </div> | ||
25 changes: 25 additions & 0 deletions
25
...es/visual-editor-renderer-blade/resources/views/blocks/artisanpack/comment-date.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\UrlSanitizer; | ||
|
|
||
| $dateIso = isset( $attributes['_resolvedDate'] ) && is_string( $attributes['_resolvedDate'] ) ? $attributes['_resolvedDate'] : ''; | ||
| $date = isset( $attributes['_resolvedDateFormatted'] ) && is_string( $attributes['_resolvedDateFormatted'] ) ? $attributes['_resolvedDateFormatted'] : ''; | ||
| $url = UrlSanitizer::safe( isset( $attributes['_resolvedPermalink'] ) && is_string( $attributes['_resolvedPermalink'] ) ? $attributes['_resolvedPermalink'] : '' ); | ||
|
|
||
| $isLink = ! empty( $attributes['isLink'] ); | ||
| @endphp | ||
| <div{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comment-date' ] ) !!}> | ||
| @if ( $isLink && '' !== $url ) | ||
| <a href="{{ $url }}"> | ||
| @if ( '' !== $dateIso ) | ||
| <time datetime="{{ $dateIso }}">{{ $date }}</time> | ||
| @else | ||
| {{ $date }} | ||
| @endif | ||
| </a> | ||
| @elseif ( '' !== $dateIso ) | ||
| <time datetime="{{ $dateIso }}">{{ $date }}</time> | ||
| @else | ||
| {{ $date }} | ||
| @endif | ||
| </div> |
15 changes: 15 additions & 0 deletions
15
...sual-editor-renderer-blade/resources/views/blocks/artisanpack/comment-edit-link.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\UrlSanitizer; | ||
|
|
||
| $url = UrlSanitizer::safe( isset( $attributes['_resolvedEditLinkUrl'] ) && is_string( $attributes['_resolvedEditLinkUrl'] ) ? $attributes['_resolvedEditLinkUrl'] : '' ); | ||
| $label = isset( $attributes['_resolvedEditLinkLabel'] ) && is_string( $attributes['_resolvedEditLinkLabel'] ) ? $attributes['_resolvedEditLinkLabel'] : __( 'Edit' ); | ||
|
|
||
| $linkTarget = isset( $attributes['linkTarget'] ) && is_string( $attributes['linkTarget'] ) ? $attributes['linkTarget'] : '_self'; | ||
| $targetAttr = '_blank' === $linkTarget ? ' target="_blank" rel="noopener noreferrer"' : ''; | ||
| @endphp | ||
| @if ( '' !== $url ) | ||
| <div{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comment-edit-link' ] ) !!}> | ||
| <a href="{{ $url }}"{!! $targetAttr !!}>{{ $label }}</a> | ||
| </div> | ||
| @endif |
12 changes: 12 additions & 0 deletions
12
...ual-editor-renderer-blade/resources/views/blocks/artisanpack/comment-reply-link.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\UrlSanitizer; | ||
|
|
||
| $url = UrlSanitizer::safe( isset( $attributes['_resolvedReplyLinkUrl'] ) && is_string( $attributes['_resolvedReplyLinkUrl'] ) ? $attributes['_resolvedReplyLinkUrl'] : '' ); | ||
| $label = isset( $attributes['_resolvedReplyLinkLabel'] ) && is_string( $attributes['_resolvedReplyLinkLabel'] ) ? $attributes['_resolvedReplyLinkLabel'] : __( 'Reply' ); | ||
| @endphp | ||
| @if ( '' !== $url ) | ||
| <div{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comment-reply-link' ] ) !!}> | ||
| <a href="{{ $url }}">{{ $label }}</a> | ||
| </div> | ||
| @endif |
16 changes: 16 additions & 0 deletions
16
...isual-editor-renderer-blade/resources/views/blocks/artisanpack/comment-template.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
| @endphp | ||
| {{-- | ||
| comment-template wrapper. | ||
|
|
||
| The server-side CommentInliner clones this block's inner tree once | ||
| per resolved comment and stamps each iteration with the per-comment | ||
| `_resolved*` attributes via CommentResolver, then concatenates the | ||
| rendered iterations into `$innerBlocksHtml`. The renderer just | ||
| wraps the result in the `<ol class="wp-block-comment-template">` | ||
| scaffold WordPress uses. | ||
| --}} | ||
| <ol{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comment-template' ] ) !!}> | ||
| {!! $innerBlocksHtml !!} | ||
| </ol> |
14 changes: 14 additions & 0 deletions
14
...itor-renderer-blade/resources/views/blocks/artisanpack/comments-pagination-next.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\UrlSanitizer; | ||
|
|
||
| $url = UrlSanitizer::safe( isset( $attributes['_resolvedNextPageUrl'] ) && is_string( $attributes['_resolvedNextPageUrl'] ) ? $attributes['_resolvedNextPageUrl'] : '' ); | ||
| $label = isset( $attributes['label'] ) && is_string( $attributes['label'] ) && '' !== $attributes['label'] | ||
| ? $attributes['label'] | ||
| : __( 'Newer Comments' ); | ||
| @endphp | ||
| @if ( '' !== $url ) | ||
| <a{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comments-pagination-next' ] ) !!} href="{{ $url }}">{{ $label }} →</a> | ||
| @else | ||
| <span{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comments-pagination-next' ] ) !!}>{{ $label }}</span> | ||
| @endif |
22 changes: 22 additions & 0 deletions
22
...r-renderer-blade/resources/views/blocks/artisanpack/comments-pagination-numbers.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\UrlSanitizer; | ||
|
|
||
| $pages = isset( $attributes['_resolvedPageNumbers'] ) && is_array( $attributes['_resolvedPageNumbers'] ) ? $attributes['_resolvedPageNumbers'] : []; | ||
| $current = isset( $attributes['_resolvedCurrentPage'] ) && is_numeric( $attributes['_resolvedCurrentPage'] ) ? (int) $attributes['_resolvedCurrentPage'] : 1; | ||
| @endphp | ||
| <div{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comments-pagination-numbers' ] ) !!}> | ||
| @foreach ( $pages as $page ) | ||
| @php | ||
| $number = isset( $page['number'] ) && is_numeric( $page['number'] ) ? (int) $page['number'] : 0; | ||
| $href = UrlSanitizer::safe( isset( $page['url'] ) && is_string( $page['url'] ) ? $page['url'] : '' ); | ||
| @endphp | ||
| @if ( 0 !== $number ) | ||
| @if ( $number === $current || '' === $href ) | ||
| <span class="page-numbers current" aria-current="page">{{ $number }}</span> | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| @else | ||
| <a class="page-numbers" href="{{ $href }}">{{ $number }}</a> | ||
| @endif | ||
| @endif | ||
| @endforeach | ||
| </div> | ||
14 changes: 14 additions & 0 deletions
14
...-renderer-blade/resources/views/blocks/artisanpack/comments-pagination-previous.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\UrlSanitizer; | ||
|
|
||
| $url = UrlSanitizer::safe( isset( $attributes['_resolvedPreviousPageUrl'] ) && is_string( $attributes['_resolvedPreviousPageUrl'] ) ? $attributes['_resolvedPreviousPageUrl'] : '' ); | ||
| $label = isset( $attributes['label'] ) && is_string( $attributes['label'] ) && '' !== $attributes['label'] | ||
| ? $attributes['label'] | ||
| : __( 'Older Comments' ); | ||
| @endphp | ||
| @if ( '' !== $url ) | ||
| <a{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comments-pagination-previous' ] ) !!} href="{{ $url }}">← {{ $label }}</a> | ||
| @else | ||
| <span{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comments-pagination-previous' ] ) !!}>{{ $label }}</span> | ||
| @endif |
6 changes: 6 additions & 0 deletions
6
...al-editor-renderer-blade/resources/views/blocks/artisanpack/comments-pagination.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
| @endphp | ||
| <nav{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comments-pagination' ] ) !!} aria-label="{{ __( 'Comments pagination' ) }}"> | ||
| {!! $innerBlocksHtml !!} | ||
| </nav> |
9 changes: 9 additions & 0 deletions
9
packages/visual-editor-renderer-blade/resources/views/blocks/artisanpack/comments.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
|
|
||
| $tagName = isset( $attributes['tagName'] ) && is_string( $attributes['tagName'] ) ? $attributes['tagName'] : 'div'; | ||
| $tagName = in_array( strtolower( $tagName ), [ 'div', 'section', 'article', 'aside', 'footer' ], true ) ? strtolower( $tagName ) : 'div'; | ||
| @endphp | ||
| <{!! $tagName !!}{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-comments' ] ) !!}> | ||
| {!! $innerBlocksHtml !!} | ||
| </{!! $tagName !!}> |
6 changes: 6 additions & 0 deletions
6
...al-editor-renderer-blade/resources/views/blocks/artisanpack/post-comments-count.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
|
|
||
| $count = isset( $attributes['_resolvedCommentCount'] ) && is_numeric( $attributes['_resolvedCommentCount'] ) ? (int) $attributes['_resolvedCommentCount'] : 0; | ||
| @endphp | ||
| <div{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-post-comments-count' ] ) !!}>{{ $count }}</div> |
64 changes: 64 additions & 0 deletions
64
...ual-editor-renderer-blade/resources/views/blocks/artisanpack/post-comments-form.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\UrlSanitizer; | ||
|
|
||
| // Default form target is the cms-framework comments REST endpoint | ||
| // (`POST /api/v1/comments`). That route returns 201 + JSON though, | ||
| // which is great for SPAs but not for a plain HTML form submit — | ||
| // the browser navigates to the JSON. Host apps that want a | ||
| // classic form-post UX should override this via the | ||
| // `comments.form.action` filter (artisanpack-ui/hooks) and point | ||
| // it at a controller that creates the comment and redirects back. | ||
| $defaultAction = isset( $attributes['_resolvedFormAction'] ) && is_string( $attributes['_resolvedFormAction'] ) | ||
| ? $attributes['_resolvedFormAction'] | ||
| : '/api/v1/comments'; | ||
| if ( function_exists( 'applyFilters' ) ) { | ||
| $defaultAction = ( string ) applyFilters( 'comments.form.action', $defaultAction ); | ||
| } | ||
| $formAction = UrlSanitizer::safe( $defaultAction ); | ||
| @endphp | ||
| {{-- | ||
| post-comments-form | ||
|
|
||
| Renders a minimal, semantically-correct comment form. The default | ||
| `action` posts to cms-framework's `/api/v1/comments` endpoint; the | ||
| `comments.form.action` filter lets host apps redirect submissions | ||
| to their own controller so they can validate, persist, and redirect | ||
| back to the post with a flash message — the standard browser-form | ||
| UX the API endpoint can't provide on its own. | ||
| --}} | ||
| <div{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-post-comments-form', 'comment-respond' ] ) !!}> | ||
| <h3 class="comment-reply-title">{{ __( 'Leave a Comment' ) }}</h3> | ||
| <form action="{{ $formAction }}" method="post" class="comment-form"> | ||
| @if ( function_exists( 'csrf_field' ) ) | ||
| {!! csrf_field() !!} | ||
| @endif | ||
| @isset( $attributes['_resolvedPostId'] ) | ||
| <input type="hidden" name="post_id" value="{{ (int) $attributes['_resolvedPostId'] }}" /> | ||
| @endisset | ||
| <p class="comment-form-author"> | ||
| <label for="comment-author">{{ __( 'Name' ) }} <span aria-hidden="true">*</span></label> | ||
| <input id="comment-author" name="author_name" type="text" autocomplete="name" required /> | ||
| </p> | ||
| <p class="comment-form-email"> | ||
| <label for="comment-email">{{ __( 'Email' ) }} <span aria-hidden="true">*</span></label> | ||
| <input id="comment-email" name="author_email" type="email" autocomplete="email" required /> | ||
| </p> | ||
| <p class="comment-form-url"> | ||
| <label for="comment-url">{{ __( 'Website' ) }}</label> | ||
| <input id="comment-url" name="author_url" type="url" autocomplete="url" /> | ||
| </p> | ||
| <p class="comment-form-comment"> | ||
| <label for="comment-content">{{ __( 'Comment' ) }} <span aria-hidden="true">*</span></label> | ||
| <textarea id="comment-content" name="content" rows="6" required></textarea> | ||
| </p> | ||
| <p class="form-submit"> | ||
| {{-- Deliberately no `name="submit"` on the input — that | ||
| attribute shadows the form's `.submit` property in | ||
| the DOM and breaks any JS that hooks the form | ||
| (analytics, validation libraries, etc.). The | ||
| value isn't read server-side either. --}} | ||
| <input type="submit" class="submit" value="{{ __( 'Post Comment' ) }}" /> | ||
| </p> | ||
| </form> | ||
| </div> |
17 changes: 17 additions & 0 deletions
17
...ual-editor-renderer-blade/resources/views/blocks/artisanpack/post-comments-link.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\UrlSanitizer; | ||
|
|
||
| $count = isset( $attributes['_resolvedCommentCount'] ) && is_numeric( $attributes['_resolvedCommentCount'] ) ? (int) $attributes['_resolvedCommentCount'] : 0; | ||
| $url = UrlSanitizer::safe( isset( $attributes['_resolvedCommentsUrl'] ) && is_string( $attributes['_resolvedCommentsUrl'] ) ? $attributes['_resolvedCommentsUrl'] : '' ); | ||
| $label = isset( $attributes['_resolvedCommentsLabel'] ) && is_string( $attributes['_resolvedCommentsLabel'] ) | ||
| ? $attributes['_resolvedCommentsLabel'] | ||
| : trans_choice( '{0} :count Comments|{1} :count Comment|[2,*] :count Comments', $count, [ 'count' => $count ] ); | ||
| @endphp | ||
| <div{!! BlockSupports::wrapperAttrs( $attributes, [ 'wp-block-post-comments-link' ] ) !!}> | ||
| @if ( '' !== $url ) | ||
| <a href="{{ $url }}">{{ $label }}</a> | ||
| @else | ||
| {{ $label }} | ||
| @endif | ||
| </div> |
24 changes: 24 additions & 0 deletions
24
...al-editor-renderer-blade/resources/views/blocks/artisanpack/post-comments-title.blade.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| @php | ||
| use ArtisanPackUI\VisualEditorRendererBlade\Support\BlockSupports; | ||
|
|
||
| $level = isset( $attributes['level'] ) && is_numeric( $attributes['level'] ) ? (int) $attributes['level'] : 2; | ||
| $level = max( 1, min( 6, $level ) ); | ||
| $tag = 'h' . $level; | ||
|
|
||
| $showCount = ! isset( $attributes['showCommentsCount'] ) || ! empty( $attributes['showCommentsCount'] ); | ||
| $count = isset( $attributes['_resolvedCommentCount'] ) && is_numeric( $attributes['_resolvedCommentCount'] ) ? (int) $attributes['_resolvedCommentCount'] : 0; | ||
| $title = isset( $attributes['_resolvedCommentsTitle'] ) && is_string( $attributes['_resolvedCommentsTitle'] ) | ||
| ? $attributes['_resolvedCommentsTitle'] | ||
| : ( 0 === $count ? 'No Comments' : ( 1 === $count ? '1 Comment' : $count . ' Comments' ) ); | ||
|
|
||
| if ( ! $showCount ) { | ||
| $title = 'Comments'; | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| $align = isset( $attributes['textAlign'] ) && is_string( $attributes['textAlign'] ) ? $attributes['textAlign'] : ''; | ||
| $classes = [ 'wp-block-post-comments-title' ]; | ||
| if ( '' !== $align ) { | ||
| $classes[] = 'has-text-align-' . $align; | ||
| } | ||
| @endphp | ||
| <{!! $tag !!}{!! BlockSupports::wrapperAttrs( $attributes, $classes ) !!}>{{ $title }}</{!! $tag !!}> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.