| @@ -10,8 +10,9 @@ | ||
| 10 | 10 | |
| 11 | 11 | use Extendify\Agent\PostBlockFinder; |
| 12 | 12 | use Extendify\Agent\TemplatePartBlockFinder; |
| 13 | 13 | use Extendify\Constants; |
| 14 | +use Extendify\Shared\Services\HeroDescription; | |
| 14 | 15 | use Extendify\Shared\Services\Sanitizer; |
| 15 | 16 | use Extendify\Shared\Services\SiteImages; |
| 16 | 17 | |
| 17 | 18 | /** |
| @@ -572,10 +573,18 @@ | ||
| 572 | 573 | 1 |
| 573 | 574 | ); |
| 574 | 575 | } |
| 575 | 576 | |
| 576 | - if ($description) { | |
| 577 | + if (trim((string) $description) === '') { | |
| 578 | + // Catalog paragraphs describe the slot, not the site. | |
| 577 | 579 | $code = preg_replace( |
| 580 | + '/<!-- wp:paragraph[\s\S]*?<!-- \/wp:paragraph -->/m', | |
| 581 | + '', | |
| 582 | + $code, | |
| 583 | + 1 | |
| 584 | + ); | |
| 585 | + } else { | |
| 586 | + $code = preg_replace( | |
| 578 | 587 | '/(<!-- wp:paragraph[^>]*-->[\s\S]*?<p[^>]*>)[\s\S]*?(<\/p>[\s\S]*?<!-- \/wp:paragraph -->)/m', |
| 579 | 588 | '${1}' . esc_html($description) . '${2}', |
| 580 | 589 | $code, |
| 581 | 590 | 1 |
| @@ -762,9 +771,9 @@ | ||
| 762 | 771 | |
| 763 | 772 | public static function getSiteDesignVariations(\WP_REST_Request $request) |
| 764 | 773 | { |
| 765 | 774 | $title = $request->get_param('title'); |
| 766 | - $description = $request->get_param('description'); | |
| 775 | + $description = HeroDescription::resolve($request->get_param('description')); | |
| 767 | 776 | $images = $request->get_param('images') ?? []; |
| 768 | 777 | $cta = $request->get_param('cta'); |
| 769 | 778 | $featuredOnly = true; // Only show featured patterns |
| 770 | 779 | $currentHeroPattern = $request->get_param('currentHeroPattern'); |