| 1 |
<?php |
| 2 |
/** |
| 3 |
* Fediverse Profile Page pattern. |
| 4 |
* |
| 5 |
* @package Activitypub |
| 6 |
*/ |
| 7 |
|
| 8 |
$selected_user = ! \Activitypub\is_user_type_disabled( 'blog' ) ? 'blog' : 'inherit'; |
| 9 |
|
| 10 |
$following_block = ''; |
| 11 |
if ( '1' === \get_option( 'activitypub_following_ui', '0' ) ) { |
| 12 |
$following_block = ' |
| 13 |
<!-- wp:spacer {"height":"32px"} --> |
| 14 |
<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div> |
| 15 |
<!-- /wp:spacer --> |
| 16 |
<!-- wp:activitypub/following {"selectedUser":"' . $selected_user . '"} --> |
| 17 |
<div class="wp-block-activitypub-following"><!-- wp:heading {"level":3} --> |
| 18 |
<h3 class="wp-block-heading">' . esc_html_x( 'Following', 'Block pattern content', 'activitypub' ) . '</h3> |
| 19 |
<!-- /wp:heading --></div> |
| 20 |
<!-- /wp:activitypub/following -->'; |
| 21 |
} |
| 22 |
|
| 23 |
\register_block_pattern( |
| 24 |
'activitypub/profile-page', |
| 25 |
array( |
| 26 |
'title' => _x( 'Fediverse Profile Page', 'Block pattern title', 'activitypub' ), |
| 27 |
'categories' => array( 'activitypub' ), |
| 28 |
'keywords' => array( |
| 29 |
_x( 'profile', 'Block pattern keyword', 'activitypub' ), |
| 30 |
_x( 'fediverse', 'Block pattern keyword', 'activitypub' ), |
| 31 |
_x( 'page', 'Block pattern keyword', 'activitypub' ), |
| 32 |
_x( 'extra fields', 'Block pattern keyword', 'activitypub' ), |
| 33 |
_x( 'followers', 'Block pattern keyword', 'activitypub' ), |
| 34 |
), |
| 35 |
'description' => '1' === \get_option( 'activitypub_following_ui', '0' ) |
| 36 |
? _x( 'Full profile page with extra fields, followers, and following lists.', 'Block pattern description', 'activitypub' ) |
| 37 |
: _x( 'Full profile page with extra fields and followers list.', 'Block pattern description', 'activitypub' ), |
| 38 |
'viewportWidth' => 1200, |
| 39 |
'postTypes' => array( 'page' ), |
| 40 |
'blockTypes' => array( 'core/post-content' ), |
| 41 |
'content' => '<!-- wp:group {"layout":{"type":"constrained"}} --> |
| 42 |
<div class="wp-block-group"> |
| 43 |
<!-- wp:activitypub/follow-me {"selectedUser":"' . $selected_user . '","className":"is-style-profile"} /--> |
| 44 |
<!-- wp:spacer {"height":"32px"} --> |
| 45 |
<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div> |
| 46 |
<!-- /wp:spacer --> |
| 47 |
<!-- wp:activitypub/extra-fields {"selectedUser":"' . $selected_user . '"} /--> |
| 48 |
<!-- wp:spacer {"height":"32px"} --> |
| 49 |
<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div> |
| 50 |
<!-- /wp:spacer --> |
| 51 |
<!-- wp:activitypub/followers {"selectedUser":"' . $selected_user . '"} --> |
| 52 |
<div class="wp-block-activitypub-followers"><!-- wp:heading {"level":3} --> |
| 53 |
<h3 class="wp-block-heading">' . esc_html_x( 'Followers', 'Block pattern content', 'activitypub' ) . '</h3> |
| 54 |
<!-- /wp:heading --></div> |
| 55 |
<!-- /wp:activitypub/followers -->' . $following_block . ' |
| 56 |
</div> |
| 57 |
<!-- /wp:group -->', |
| 58 |
) |
| 59 |
); |
| 60 |
|