feat(wpmc S4): TermMeta registers ACF main_page_alt on taxonomy town
Add acf-stubs.php + TestCase::setUp() require-after-Patchwork pattern so acf_add_local_field_group is Patchwork-instrumented and re-interceptable across FieldGroupTest and TermMetaTest in the same PHP process. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WPMultiCity;
|
||||
|
||||
final class TermMeta
|
||||
{
|
||||
public const GROUP_KEY = 'group_wpmc_town_main_page';
|
||||
|
||||
public static function register(): void
|
||||
{
|
||||
add_action('acf/init', [self::class, 'do_register']);
|
||||
}
|
||||
|
||||
public static function do_register(): void
|
||||
{
|
||||
if (!function_exists('acf_add_local_field_group')) {
|
||||
return;
|
||||
}
|
||||
acf_add_local_field_group([
|
||||
'key' => self::GROUP_KEY,
|
||||
'title' => 'WPMultiCity / Town main page',
|
||||
'fields' => [
|
||||
[
|
||||
'key' => 'field_wpmc_main_page_alt',
|
||||
'label' => __('Главная страница для этого города', 'wp-multi-city'),
|
||||
'name' => 'main_page_alt',
|
||||
'type' => 'post_object',
|
||||
'post_type' => ['page'],
|
||||
'return_format' => 'id',
|
||||
'allow_null' => 1,
|
||||
'multiple' => 0,
|
||||
],
|
||||
],
|
||||
'location' => [
|
||||
[['param' => 'taxonomy', 'operator' => '==', 'value' => 'town']],
|
||||
],
|
||||
'menu_order' => 0,
|
||||
'position' => 'normal',
|
||||
'style' => 'default',
|
||||
'active' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user