Troubleshooting_Diagnostics::register_settings_section()

Summary

No summary available.

Source

File: src/BigCommerce/Settings/Sections/Troubleshooting_Diagnostics.php

		add_settings_section(
			self::NAME,
			__( 'Diagnostics', 'bigcommerce' ),
			'__return_false',
			Settings_Screen::NAME
		);

		add_settings_field(
			self::SYNC_SITE_URL,
			esc_html( __( 'Sync Site URL', 'bigcommerce' ) ),
			[ $this, 'render_sync_site_url', ],
			Settings_Screen::NAME,
			self::NAME,
			[
				'type'        => 'checkbox',
				'option'      => self::SYNC_SITE_URL,
				'label'       => __( 'Sync Site URL', 'bigcommerce' ),
				'description' => __( 'Manually sync site URL with BigCommerce.', 'bigcommerce' ),
			]
		);

		register_setting(
			Settings_Screen::NAME,
			self::LOG_ERRORS
		);

		add_settings_field(
			self::LOG_ERRORS,
			esc_html( __( 'Log import errors', 'bigcommerce' ) ),
			[ $this, 'render_enable_import_errors', ],
			Settings_Screen::NAME,
			self::NAME,
			[
				'type'        => 'checkbox',
				'option'      => self::LOG_ERRORS,
				'label'       => esc_html( __( 'Enable Error Logs', 'bigcommerce' ) ),
				'description' => esc_html( __( 'If enabled, will log import error messages to /wp-content/uploads/logs/bigcommerce/debug.log. If you want to use a different path please define BIGCOMMERCE_DEBUG_LOG in your wp-config.php with the desired writeable path.', 'bigcommerce' ) ),
			]
		);

		register_setting(
			Settings_Screen::NAME,
			self::LOG_FILE_SIZE
		);

		add_settings_field(
			self::LOG_FILE_SIZE,
			esc_html( __( 'Log file max size(MB)', 'bigcommerce' ) ),
			[ $this, 'render_log_file_size', ],
			Settings_Screen::NAME,
			self::NAME,
			[
				'min'         => 1,
				'max'         => 25,
				'type'        => 'number',
				'option'      => self::LOG_FILE_SIZE,
				'label'       => esc_html( __( 'Set log file size', 'bigcommerce' ) ),
				'description' => esc_html( __( 'Set log file max size in MB. If log file exceeds the limit it will be cleaned before new import', 'bigcommerce' ) ),
			]
		);

		add_settings_field(
			self::DIAGNOSTICS_NAME,
			esc_html( __( 'Troubleshooting Diagnostics', 'bigcommerce' ) ),
			[ $this, 'render_field' ],
			Settings_Screen::NAME,
			self::NAME,
			[
				'type'        => 'text',
				'option'      => self::DIAGNOSTICS_NAME,
				'label'       => esc_html( __( 'Troubleshooting and Diagnostics', 'bigcommerce' ) ),
				'description' => esc_html( __( 'The following is information about your WordPress install that may be helpful information to provide to BigCommerce Customer Support in the event that issues arise and you require help troubleshooting.', 'bigcommerce' ) ),
			]
		);


	}

	public function render_sync_site_url( $args ) {
		$url  = add_query_arg( [ 'action' => self::SYNC_SITE_URL, '_wpnonce' => wp_create_nonce( self::SYNC_SITE_URL ) ], admin_url( 'admin-post.php' ) );
		$link = sprintf( '<a href="%s" class="bc-admin-btn">%s</a>', esc_url( $url ), esc_attr( $args[ 'label' ] ) );
		printf( '%s<p class="description">%s</p>', $link, esc_html( $args[ 'description' ] ) );
	}

	/**
	 * @param array $args
	 */
	public function render_field( $args ) {
		if ( ! empty( $args[ 'description' ] ) ) {
			printf( '<p>%s</p>', esc_html( $args[ 'description' ] ) );
		}


User Contributed Notes

You must log in before being able to contribute a note or feedback.