# convertkit/3.4.3/includes/plugin-sidebars/class-convertkit-plugin-sidebar.php

Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages, version 3.4.3. 204 lines.

- Page: https://pluginprobe.com/plugins/convertkit/3.4.3/code/includes/plugin-sidebars/class-convertkit-plugin-sidebar.php
- Raw: https://pluginprobe.com/plugins/convertkit/3.4.3/raw/includes/plugin-sidebars/class-convertkit-plugin-sidebar.php
- Modified: 2026-04-22T12:35:30+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/convertkit/3.4.3/code/includes/plugin-sidebars/class-convertkit-plugin-sidebar.php#L10-L20`.

```php
<?php
/**
 * ConvertKit Plugin Sidebar class.
 *
 * @package ConvertKit
 * @author ConvertKit
 */

/**
 * ConvertKit Plugin Sidebar definition for Gutenberg.
 *
 * @package ConvertKit
 * @author  ConvertKit
 */
class ConvertKit_Plugin_Sidebar {

	/**
	 * Registers this plugin sidebar with the ConvertKit Plugin.
	 *
	 * @since   3.3.0
	 *
	 * @param   array $plugin_sidebars     Plugin Sidebars to Register.
	 * @return  array               Plugin Sidebars to Register
	 */
	public function register( $plugin_sidebars ) {

		// If the request is for the frontend, return the minimum sidebar definition required
		// for register_post_meta().
		if ( ! $this->is_admin_frontend_editor_or_admin_rest_request() ) {
			$plugin_sidebars[ $this->get_name() ] = array(
				'name'               => $this->get_name(),
				'minimum_capability' => $this->get_minimum_capability(),
				'meta_key'           => $this->get_meta_key(), // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
				'title'              => $this->get_title(),
				'attributes'         => $this->get_attributes(),
				'default_values'     => $this->get_default_values(),
			);

			return $plugin_sidebars;
		}

		$plugin_sidebars[ $this->get_name() ] = array(
			'name'               => $this->get_name(),
			'minimum_capability' => $this->get_minimum_capability(),
			'meta_key'           => $this->get_meta_key(), // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
			'title'              => $this->get_title(),
			'icon'               => $this->get_icon(),
			'gutenberg_icon'     => convertkit_get_file_contents( CONVERTKIT_PLUGIN_PATH . '/' . $this->get_icon() ),
			'fields'             => $this->get_fields(),
			'attributes'         => $this->get_attributes(),
			'default_values'     => $this->get_default_values(),
		);

		return $plugin_sidebars;

	}

	/**
	 * Returns this plugin sidebar's meta key.
	 *
	 * @since   3.3.0
	 */
	public function get_name() {

		return '';

	}

	/**
	 * Returns this plugin sidebar's minimum capability required
	 * for displaying and permitting edits to the settings.
	 *
	 * @since   3.3.0
	 *
	 * @return  string
	 */
	public function get_minimum_capability() {

		return 'edit_posts';

	}

	/**
	 * Returns this plugin sidebar's meta key.
	 *
	 * @since   3.3.0
	 *
	 * @return  string
	 */
	public function get_meta_key() {

		return '';

	}

	/**
	 * Returns this plugin sidebar's title.
	 *
	 * @since   3.3.0
	 */
	public function get_title() {

		return '';

	}

	/**
	 * Returns this plugin sidebar's icon.
	 *
	 * @since   3.3.0
	 */
	public function get_icon() {

		return '';

	}

	/**
	 * Returns this plugin sidebar's attributes.
	 *
	 * @since   3.3.0
	 *
	 * @return  array
	 */
	public function get_attributes() {

		return array();

	}

	/**
	 * Returns this plugin sidebar's Fields
	 *
	 * @since   3.3.0
	 *
	 * @return  array
	 */
	public function get_fields() {

		return array();

	}

	/**
	 * Returns this plugin sidebar's Default Values
	 *
	 * @since   3.3.0
	 *
	 * @return  array
	 */
	public function get_default_values() {

		return array();

	}

	/**
	 * Returns the given plugin sidebar's field's Default Value
	 *
	 * @since   3.3.0
	 *
	 * @param   string $field Field Name.
	 * @return  string
	 */
	public function get_default_value( $field ) {

		$defaults = $this->get_default_values();
		if ( isset( $defaults[ $field ] ) ) {
			return $defaults[ $field ];
		}

		return '';

	}

	/**
	 * Determines if the request is a WordPress REST API request
	 * made by a logged in WordPress user who has the capability to edit posts.
	 *
	 * @since   3.3.0
	 *
	 * @return  bool
	 */
	public function is_admin_rest_request() {

		return defined( 'REST_REQUEST' ) && REST_REQUEST && current_user_can( 'edit_posts' );

	}

	/**
	 * Determines if the request is for the WordPress Administration, frontend editor or REST API request.
	 *
	 * @since   3.3.0
	 *
	 * @return  bool
	 */
	public function is_admin_frontend_editor_or_admin_rest_request() {

		return WP_ConvertKit()->is_admin_or_frontend_editor() || $this->is_admin_rest_request();

	}

}

```
