Form_Manager::__construct( string $prefix, array $services, awsmug\Torro_Forms\Translations\Translations_Form_Manager $translations )

Constructor.

Description

See also

Parameters

$prefix

(string) (Required) The instance prefix.

$services

(array) (Required) Array of service instances.

  • 'capabilities'
    (Form_Capabilities) The capabilities instance.
  • 'template'
    (Template) The template instance.
  • 'options'
    (Options) The options instance.
  • 'assets'
    (Assets) The assets instance.
  • 'ajax'
    (AJAX) The AJAX 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_Manager) (Required) Translations instance.

Source

File: src/db-objects/forms/form-manager.php

	public function __construct( $prefix, $services, $translations ) {
		$this->class_name                 = Form::class;
		$this->collection_class_name      = Form_Collection::class;
		$this->query_class_name           = Form_Query::class;
		$this->rest_controller_class_name = REST_Forms_Controller::class;

		$this->singular_slug = 'form';
		$this->plural_slug   = 'forms';

		$this->table_name  = 'posts';
		$this->cache_group = 'posts';
		$this->meta_type   = 'post';

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

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

		$this->public = true;

		$this->frontend_submission_handler = new Form_Frontend_Submission_Handler( $this );
		$this->frontend_output_handler     = new Form_Frontend_Output_Handler( $this );
		$this->list_page_handler           = new Form_List_Page_Handler( $this );
		$this->edit_page_handler           = new Form_Edit_Page_Handler( $this );

		// TODO: Remove this instantiation in the future.
		$this->legacy_upgrades = new Legacy_Upgrades( $prefix );

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

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

Changelog

Changelog
Version Description
1.0.0 Introduced.