Element_Choice_Manager::__construct( string $prefix, array $services, awsmug\Torro_Forms\Translations\Translations_Element_Choice_Manager $translations )

Constructor.

Description

Parameters

$prefix

(string) (Required) The instance prefix.

$services

(array) (Required) Array of service instances.

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

$translations

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

Source

File: src/db-objects/element-choices/element-choice-manager.php

	public function __construct( $prefix, $services, $translations ) {
		$this->class_name                 = Element_Choice::class;
		$this->collection_class_name      = Element_Choice_Collection::class;
		$this->query_class_name           = Element_Choice_Query::class;
		$this->rest_controller_class_name = REST_Element_Choices_Controller::class;

		$this->singular_slug = 'element_choice';
		$this->plural_slug   = 'element_choices';

		$this->table_name  = $this->plural_slug;
		$this->cache_group = $this->plural_slug;

		$this->primary_property = 'id';
		$this->title_property   = 'value';

		$this->public = true;

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

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

Changelog

Changelog
Version Description
1.0.0 Introduced.