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

wp-graphql / wp-graphql / 13316763745

13 Feb 2025 08:45PM UTC coverage: 82.712% (-0.3%) from 83.023%
13316763745

push

github

web-flow
Merge pull request #3307 from wp-graphql/release/v2.0.0

release: v2.0.0

195 of 270 new or added lines in 20 files covered. (72.22%)

180 existing lines in 42 files now uncovered.

13836 of 16728 relevant lines covered (82.71%)

299.8 hits per line

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

0.0
/src/Admin/Admin.php
1
<?php
2

3
namespace WPGraphQL\Admin;
4

5
use WPGraphQL\Admin\Extensions\Extensions;
6
use WPGraphQL\Admin\GraphiQL\GraphiQL;
7
use WPGraphQL\Admin\Settings\Settings;
8

9
/**
10
 * Class Admin
11
 *
12
 * @package WPGraphQL\Admin
13
 */
14
class Admin {
15

16
        /**
17
         * Whether Admin Pages are enabled or not
18
         *
19
         * @var bool
20
         */
21
        protected $admin_enabled;
22

23
        /**
24
         * Whether GraphiQL is enabled or not
25
         *
26
         * @var bool
27
         */
28
        protected $graphiql_enabled;
29

30
        /**
31
         * @var \WPGraphQL\Admin\Settings\Settings
32
         */
33
        protected $settings;
34

35
        /**
36
         * @var \WPGraphQL\Admin\Extensions\Extensions
37
         */
38
        protected $extensions;
39

40
        /**
41
         * Initialize Admin functionality for WPGraphQL
42
         *
43
         * @return void
44
         */
UNCOV
45
        public function init() {
×
46

47
                // Determine whether the admin pages should show or not.
48
                // Default is enabled.
49
                $this->admin_enabled    = apply_filters( 'graphql_show_admin', true );
×
50
                $this->graphiql_enabled = apply_filters( 'graphql_enable_graphiql', get_graphql_setting( 'graphiql_enabled', true ) );
×
51

52
                AdminNotices::get_instance();
×
53

54
                // This removes the menu page for WPGraphiQL as it's now built into WPGraphQL
55
                if ( $this->graphiql_enabled ) {
×
56
                        add_action(
×
57
                                'admin_menu',
×
58
                                static function () {
×
59
                                        remove_menu_page( 'wp-graphiql/wp-graphiql.php' );
×
60
                                }
×
61
                        );
×
62
                }
63

64
                // If the admin is disabled, prevent admin from being scaffolded.
65
                if ( false === $this->admin_enabled ) {
×
66
                        return;
×
67
                }
68

69
                $this->settings = new Settings();
×
70
                $this->settings->init();
×
71

72
                if ( 'on' === $this->graphiql_enabled || true === $this->graphiql_enabled ) {
×
73
                        global $graphiql;
×
74
                        $graphiql = new GraphiQL();
×
75
                        $graphiql->init();
×
76
                }
77

78
                $this->extensions = new Extensions();
×
79
                $this->extensions->init();
×
80
        }
81
}
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

© 2026 Coveralls, Inc