Form_Category_Manager::__construct( string $prefix, array $services, awsmug\Torro_Forms\Translations\Translations_Form_Category_Manager $translations )

Constructor.

Description

Parameters

$prefix

(string) (Required) The instance prefix.

$services

(array) (Required) Array of service instances.

  • 'capabilities'
    (Form_Category_Capabilities) The capabilities instance.
  • 'db'
    (DB) The database instance.
  • 'cache'
    (Cache) The cache instance.
  • 'meta'
    (Meta) The meta instance.
  • 'error_handler'
    (Error_Handler) The error handler instance.

$translations

(awsmug\Torro_Forms\Translations\Translations_Form_Category_Manager) (Required) Translations instance.

Source

File: src/db-objects/form-categories/form-category-manager.php

	public function __construct( $prefix, $services, $translations ) {
		$this->class_name                 = Form_Category::class;
		$this->collection_class_name      = Form_Category_Collection::class;
		$this->query_class_name           = Form_Category_Query::class;
		$this->rest_controller_class_name = REST_Form_Categories_Controller::class;

		$this->singular_slug = 'form_category';
		$this->plural_slug   = 'form_categories';

		$this->table_name  = 'terms';
		$this->cache_group = 'terms';
		$this->meta_type   = 'term';

		$this->fetch_callback = array( $this, 'fetch_from_db' );

		$this->primary_property = 'id';
		$this->title_property   = 'title';
		$this->slug_property    = 'slug';

		$this->public = true;

		parent::__construct( $prefix, $services, $translations );

		if ( defined( 'WP_CLI' ) && WP_CLI ) {
			$command = new CLI_Form_Categories_Command( $this );
			$command->add( str_replace( '_', ' ', $this->prefix ) . str_replace( '_', '-', $this->singular_slug ) );
		}
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.