Element_Manager::__construct( string $prefix, array $services, awsmug\Torro_Forms\Translations\Translations_Element_Manager $translations )

Constructor.

Description

See also

Parameters

$prefix

(string) (Required) The instance prefix.

$services

(array) (Required) Array of service instances.

  • 'capabilities'
    (Element_Capabilities) The capabilities instance.
  • 'db'
    (DB) The database instance.
  • 'assets'
    (Assets) The assets instance.
  • 'ajax'
    (AJAX) The AJAX instance.
  • 'cache'
    (Cache) The cache instance.
  • 'error_handler'
    (Error_Handler) The error handler instance.

$translations

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

Source

File: src/db-objects/elements/element-manager.php

	public function __construct( $prefix, $services, $translations ) {
		$this->class_name                 = Element::class;
		$this->collection_class_name      = Element_Collection::class;
		$this->query_class_name           = Element_Query::class;
		$this->rest_controller_class_name = REST_Elements_Controller::class;

		$this->singular_slug = 'element';
		$this->plural_slug   = 'elements';

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

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

		$this->public = true;

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

		$this->types = new Element_Type_Manager( $this->get_prefix(), array(
			'elements'      => $this,
			'assets'        => $this->assets(),
			'error_handler' => $this->error_handler(),
		) );

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

Changelog

Changelog
Version Description
1.0.0 Introduced.