pull in v11.0.1 from upstream

This commit is contained in:
2025-10-30 21:40:17 +00:00
62 changed files with 9276 additions and 6170 deletions

View File

@@ -17,10 +17,13 @@ class App extends Composer
];
/**
* Data to be passed to view before rendering.
*
* @return array
* Retrieve the site name.
*/
public function siteName(): string
{
return get_bloginfo('name', 'display');
}
public function with()
{
return [
@@ -28,20 +31,9 @@ class App extends Composer
'VideoSrcset' => new Utilities\VideoSrcset,
'ImageSrcset' => new Utilities\ImageSrcset,
'siteName' => $this->siteName(),
'siteLogo' => @file_get_contents(get_template_directory() . '/resources/images/logo-rhythm-road-entertainment.svg'),
'company_legal' => get_field('badegg_company_legal', 'option'),
'company_tel' => get_field('badegg_company_tel', 'option'),
'company_email' => get_field('badegg_company_email', 'option'),
];
}
/**
* Returns the site name.
*
* @return string
*/
public function siteName()
{
return get_bloginfo('name', 'display');
}
}

View File

@@ -15,29 +15,10 @@ class Comments extends Composer
'partials.comments',
];
/**
* Data to be passed to view before rendering.
*
* @return array
*/
public function with()
{
return [
'title' => $this->title(),
'responses' => $this->responses(),
'previous' => $this->previous(),
'next' => $this->next(),
'paginated' => $this->paginated(),
'closed' => $this->closed(),
];
}
/**
* The comment title.
*
* @return string
*/
public function title()
public function title(): string
{
return sprintf(
/* translators: %1$s is replaced with the number of comments and %2$s with the post title */
@@ -49,13 +30,11 @@ class Comments extends Composer
/**
* Retrieve the comments.
*
* @return string
*/
public function responses()
public function responses(): ?string
{
if (! have_comments()) {
return;
return null;
}
return wp_list_comments([
@@ -67,13 +46,11 @@ class Comments extends Composer
/**
* The previous comments link.
*
* @return string
*/
public function previous()
public function previous(): ?string
{
if (! get_previous_comments_link()) {
return;
return null;
}
return get_previous_comments_link(
@@ -83,13 +60,11 @@ class Comments extends Composer
/**
* The next comments link.
*
* @return string
*/
public function next()
public function next(): ?string
{
if (! get_next_comments_link()) {
return;
return null;
}
return get_next_comments_link(
@@ -99,20 +74,16 @@ class Comments extends Composer
/**
* Determine if the comments are paginated.
*
* @return bool
*/
public function paginated()
public function paginated(): bool
{
return get_comment_pages_count() > 1 && get_option('page_comments');
}
/**
* Determine if the comments are closed.
*
* @return bool
*/
public function closed()
public function closed(): bool
{
return ! comments_open() && get_comments_number() != '0' && post_type_supports(get_post_type(), 'comments');
}

View File

@@ -17,25 +17,10 @@ class Post extends Composer
'partials.content-*',
];
/**
* Data to be passed to view before rendering, but after merging.
*
* @return array
*/
public function override()
{
return [
'title' => $this->title(),
'pagination' => $this->pagination(),
];
}
/**
* Retrieve the post title.
*
* @return string
*/
public function title()
public function title(): string
{
if ($this->view->name() !== 'partials.page-header') {
return get_the_title();
@@ -70,10 +55,8 @@ class Post extends Composer
/**
* Retrieve the pagination links.
*
* @return string
*/
public function pagination()
public function pagination(): string
{
return wp_link_pages([
'echo' => 0,

View File

@@ -6,25 +6,56 @@
namespace App;
use function Roots\bundle;
use Illuminate\Support\Facades\Vite;
/**
* Register the theme assets.
* Inject styles into the block editor.
*
* @return array
*/
add_filter('block_editor_settings_all', function ($settings) {
$style = Vite::asset('resources/css/editor.scss');
$settings['styles'][] = [
'css' => "@import url('{$style}')",
];
return $settings;
});
/**
* Inject scripts into the block editor.
*
* @return void
*/
add_action('wp_enqueue_scripts', function () {
bundle('app')->enqueue();
}, 100);
add_filter('admin_head', function () {
if (! get_current_screen()?->is_block_editor()) {
return;
}
$dependencies = json_decode(Vite::content('editor.deps.json'));
foreach ($dependencies as $dependency) {
if (! wp_script_is($dependency)) {
wp_enqueue_script($dependency);
}
}
echo Vite::withEntryPoints([
'resources/js/editor.js',
])->toHtml();
});
/**
* Register the theme assets with the block editor.
* Use the generated theme.json file.
*
* @return void
* @return string
*/
add_action('enqueue_block_editor_assets', function () {
bundle('editor')->enqueue();
}, 100);
add_filter('theme_file_path', function ($path, $file) {
return $file === 'theme.json'
? public_path('build/assets/theme.json')
: $path;
}, 10, 2);
/**
* Register the initial theme setup.