# adminify/3.1.9/Inc/Admin/Options/Module_Google_PagesSpeed.php

Adminify – White Label, Admin Menu Editor, Login Customizer, version 3.1.9. 89 lines.

- Page: https://pluginprobe.com/plugins/adminify/3.1.9/code/Inc/Admin/Options/Module_Google_PagesSpeed.php
- Raw: https://pluginprobe.com/plugins/adminify/3.1.9/raw/Inc/Admin/Options/Module_Google_PagesSpeed.php
- Modified: 2023-11-11T08:00:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/adminify/3.1.9/code/Inc/Admin/Options/Module_Google_PagesSpeed.php#L10-L20`.

```php
<?php

namespace WPAdminify\Inc\Admin\Options;

use WPAdminify\Inc\Utils;
use WPAdminify\Inc\Admin\AdminSettingsModel;

if ( ! defined( 'ABSPATH' ) ) {
	die;
} // Cannot access directly.

if ( ! class_exists( 'Module_Google_PagesSpeed' ) ) {
	class Module_Google_PagesSpeed extends AdminSettingsModel {

		public function __construct() {
			$this->google_pagepseed_settings();
		}


		public function get_defaults() {
			return [
				'google_pagepseed_user_roles' => [],
				'google_pagepseed_api_key'    => '',
			];
		}


		/**
		 * Media Elements Sortable
		 *
		 * @return void
		 */

		public function google_pagepseed_api_key( &$fields ) {
			$fields[] = [
				'type'    => 'subheading',
				'content' => Utils::adminfiy_help_urls(
					__( 'Google Pagespeed Settings', 'adminify' ),
					'https://wpadminify.com/kb/google-pagespeed-insights/',
					'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
					'https://www.facebook.com/groups/jeweltheme',
					'https://wpadminify.com/support/google-pagespeed-insights/'
				),
			];

			$fields[] = [
				'id'          => 'google_pagepseed_user_roles',
				'type'        => 'select',
				'title'       => __( 'Disable for', 'adminify' ),
				'placeholder' => __( 'Select User roles you want to show', 'adminify' ),
				'options'     => 'roles',
				'multiple'    => true,
				'chosen'      => true,
				'default'     => $this->get_default_field( 'google_pagepseed_user_roles' ),
			];

			$fields[] = [
				'id'      => 'google_pagepseed_api_key',
				'type'    => 'textarea',
				'title'   => __( 'Google API Key', 'adminify' ),
				'after'   => sprintf( __( 'Don\'t have API key? Create one from <a href="%1$s" target="_blank">Google Console</a> to Unlock this feature. Read the full <a href="%2$s" target="_blank">Documentation</a>', 'adminify' ), esc_url( 'https://console.developers.google.com' ), esc_url( 'https://wpadminify.com/kb/how-to-create-google-api-key' ) ),
				'default' => $this->get_default_field( 'google_pagepseed_api_key' ),
			];
		}


		public function google_pagepseed_settings() {
			if ( ! class_exists( 'ADMINIFY' ) ) {
				return;
			}

			$fields = [];
			$this->google_pagepseed_api_key( $fields );

			// Google PageSpeed Order Section
			\ADMINIFY::createSection(
				$this->prefix,
				[
					'title'  => __( 'Google PageSpeed', 'adminify' ),
					'id'     => 'module_google_pagespeed_section',
					'parent' => 'module_settings',
					'icon'   => 'fas fa-tachometer-alt',
					'fields' => $fields,
				]
			);
		}
	}
}

```
