• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

AxeWP / wp-graphql-rank-math / 15507492505

07 Jun 2025 11:44AM UTC coverage: 86.429% (-2.0%) from 88.44%
15507492505

push

github

web-flow
dev: add support for lazy-loading `description`/`deprecationReason` config values (#121)

* chore: update strauss and deps

* dev: use callable descriptions/deprecations

* fix: dont prefix `NodeWithRankMathSeo`

* chore: fix backcompat on connections

* chore: update dep

* chore: update deps

* tests: ensure schema can build

* chore: update and cleanup

* fix: regenerate autoloader

357 of 367 new or added lines in 66 files covered. (97.28%)

60 existing lines in 60 files now uncovered.

2541 of 2940 relevant lines covered (86.43%)

11.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.11
/src/Type/WPObject/Settings/Meta/TaxonomyMeta.php
1
<?php
2
/**
3
 * The TaxonomyMeta GraphQL object.
4
 *
5
 * @package WPGraphQL\RankMath\Type\WPObject\Settings\Meta
6
 */
7

8
declare( strict_types = 1 );
9

10
namespace WPGraphQL\RankMath\Type\WPObject\Settings\Meta;
11

12
use WPGraphQL\RankMath\Type\WPInterface\MetaSettingWithArchive;
13
use WPGraphQL\RankMath\Type\WPInterface\MetaSettingWithRobots;
14
use WPGraphQL\RankMath\Vendor\AxeWP\GraphQL\Abstracts\ObjectType;
15
use WPGraphQL\RankMath\Vendor\AxeWP\GraphQL\Helper\Compat;
16

17
/**
18
 * Class - TaxonomyMeta
19
 *
20
 * @phpstan-import-type FieldConfig from \WPGraphQL\RankMath\Vendor\AxeWP\GraphQL\Interfaces\TypeWithFields
21
 */
22
class TaxonomyMeta extends ObjectType {
23
        /**
24
         * {@inheritDoc}
25
         */
26
        protected static function type_name(): string {
27
                return 'TaxonomyMetaSettings';
20✔
28
        }
29

30
        /**
31
         * {@inheritDoc}
32
         */
33
        public static function get_description(): string {
UNCOV
34
                return __( 'The RankMath SEO Taxonomy meta settings.', 'wp-graphql-rank-math' );
×
35
        }
36

37
        /**
38
         * {@inheritDoc}
39
         */
40
        public static function register(): void {
41
                /** @var \WP_Taxonomy[] */
42
                $allowed_taxonomies = \WPGraphQL::get_allowed_taxonomies( 'objects', [ 'public' => true ] );
20✔
43

44
                foreach ( $allowed_taxonomies as $tax_object ) {
20✔
45
                        $interfaces = [
20✔
46
                                MetaSettingWithRobots::get_type_name(),
20✔
47
                                MetaSettingWithArchive::get_type_name(),
20✔
48
                        ];
20✔
49

50
                        register_graphql_object_type(
20✔
51
                                ucfirst( $tax_object->graphql_single_name ) . 'MetaSettings',
20✔
52
                                Compat::resolve_graphql_config( // @todo Remove when WPGraphQL < 2.3.0 is dropped.
20✔
53
                                        [
20✔
54
                                                'description' => static fn () => sprintf(
20✔
55
                                                // translators: post type name.
56
                                                        __( 'The RankMath SEO meta settings for %s.', 'wp-graphql-rank-math' ),
20✔
57
                                                        $tax_object->label,
20✔
58
                                                ),
20✔
59
                                                'interfaces'  => $interfaces,
20✔
60
                                                'fields'      => self::get_child_type_fields( $tax_object ),
20✔
61
                                        ]
20✔
62
                                ),
20✔
63
                        );
20✔
64
                }
65

66
                parent::register();
20✔
67
        }
68

69
        /**
70
         * {@inheritDoc}
71
         */
72
        public static function get_fields(): array {
73
                /** @var \WP_Taxonomy[] */
74
                $allowed_taxonomies = \WPGraphQL::get_allowed_taxonomies( 'objects', [ 'public' => true ] );
20✔
75

76
                $fields = [];
20✔
77

78
                foreach ( $allowed_taxonomies as $tax_object ) {
20✔
79
                        $fields[ lcfirst( $tax_object->graphql_single_name ) ] = [
20✔
80
                                'type'        => $tax_object->graphql_single_name . 'MetaSettings',
20✔
81
                                'description' => static fn () => sprintf(
20✔
82
                                        // translators: taxonomy name.
83
                                        __( 'The RankMath SEO meta settings for %s.', 'wp-graphql-rank-math' ),
20✔
84
                                        $tax_object->label,
20✔
85
                                ),
20✔
86
                        ];
20✔
87
                }
88

89
                return $fields;
20✔
90
        }
91

92
        /**
93
         * Get the fields for the provided content type.
94
         *
95
         * @param \WP_Taxonomy $tax_object .
96
         *
97
         * @return array<string, FieldConfig>
98
         */
99
        public static function get_child_type_fields( \WP_Taxonomy $tax_object ): array {
100
                $fields = [
20✔
101
                        'hasCustomRobotsMeta'     => [
20✔
102
                                'type'        => 'Boolean',
20✔
103
                                'description' => static fn () => __( 'Whether custom robots meta for author page are set. Otherwise the default meta will be used, as set in the Global Meta tab.', 'wp-graphql-rank-math' ),
20✔
104
                        ],
20✔
105
                        'hasSlackEnhancedSharing' => [
20✔
106
                                'type'        => 'Boolean',
20✔
107
                                'description' => static fn () => __( 'Whether to show additional information (name & total number of posts) when an author archive is shared on Slack.', 'wp-graphql-rank-math' ),
20✔
108
                        ],
20✔
109
                ];
20✔
110

111
                if ( 'post_format' !== $tax_object->name ) {
20✔
112
                        $fields['hasSeoControls'] = [
20✔
113
                                'type'        => 'Boolean',
20✔
114
                                'description' => static fn () => __( 'Whether the SEO Controls meta box for user profile pages is enabled.', 'wp-graphql-rank-math' ),
20✔
115
                        ];
20✔
116
                        $fields['hasSnippetData'] = [
20✔
117
                                'type'        => 'Boolean',
20✔
118
                                'description' => static fn () => __( 'Whether to include snippet data for this taxonomy.', 'wp-graphql-rank-math' ),
20✔
119
                        ];
20✔
120
                }
121

122
                return $fields;
20✔
123
        }
124
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc