Form_Manager::setup_hooks()

Sets up all action and filter hooks for the service.

Description

This method must be implemented and then be called from the constructor.

See also

Source

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

	protected function setup_hooks() {
		parent::setup_hooks();

		if ( method_exists( $this, 'register_rest_routes' ) ) {
			$this->filters[] = array(
				'name'     => 'rest_api_init',
				'callback' => array( $this, 'register_rest_routes' ),
				'priority' => 10,
				'num_args' => 0,
			);
		}

		$this->actions[] = array(
			'name'     => 'rest_api_init',
			'callback' => array( $this, 'register_settings' ),
			'priority' => 1,
			'num_args' => 0,
		);

		$this->actions[] = array(
			'name'     => 'wp',
			'callback' => array( $this, 'maybe_start_session' ),
			'priority' => 1,
			'num_args' => 0,
		);

		$this->actions[] = array(
			'name'     => 'before_delete_post',
			'callback' => array( $this, 'maybe_delete_form_subcomponents' ),
			'priority' => 10,
			'num_args' => 1,
		);

		$this->actions[] = array(
			'name'     => 'wp',
			'callback' => array( $this->frontend_submission_handler, 'maybe_handle_form_submission' ),
			'priority' => 10,
			'num_args' => 0,
		);

		$this->filters[] = array(
			'name'     => 'wp_enqueue_scripts',
			'callback' => array( $this->frontend_output_handler, 'maybe_enqueue_frontend_assets' ),
			'priority' => 10,
			'num_args' => 0,
		);

		$this->filters[] = array(
			'name'     => 'the_content',
			'callback' => array( $this->frontend_output_handler, 'maybe_get_form_content' ),
			'priority' => 10,
			'num_args' => 1,
		);

		$this->filters[] = array(
			'name'     => "manage_edit-{$this->get_prefix()}form_columns",
			'callback' => array( $this->list_page_handler, 'maybe_adjust_table_columns' ),
			'priority' => 10,
			'num_args' => 1,
		);
		$this->actions[] = array(
			'name'     => "manage_{$this->get_prefix()}form_posts_custom_column",
			'callback' => array( $this->list_page_handler, 'maybe_render_custom_table_column' ),
			'priority' => 10,
			'num_args' => 2,
		);
		$this->actions[] = array(
			'name'     => 'post_row_actions',
			'callback' => array( $this->list_page_handler, 'maybe_adjust_row_actions' ),
			'priority' => 10,
			'num_args' => 2,
		);
		$this->actions[] = array(
			'name'     => 'page_row_actions',
			'callback' => array( $this->list_page_handler, 'maybe_adjust_row_actions' ),
			'priority' => 10,
			'num_args' => 2,
		);

		$this->actions[] = array(
			'name'     => 'edit_form_after_title',
			'callback' => array( $this->edit_page_handler, 'maybe_render_form_canvas' ),
			'priority' => 10,
			'num_args' => 1,
		);
		$this->actions[] = array(
			'name'     => "add_meta_boxes_{$this->get_prefix()}form",
			'callback' => array( $this->edit_page_handler, 'maybe_add_meta_boxes' ),
			'priority' => 10,
			'num_args' => 1,
		);
		$this->actions[] = array(
			'name'     => 'admin_enqueue_scripts',
			'callback' => array( $this->edit_page_handler, 'maybe_enqueue_assets' ),
			'priority' => 10,
			'num_args' => 1,
		);
		$this->actions[] = array(
			'name'     => 'admin_footer-post.php',
			'callback' => array( $this->edit_page_handler, 'maybe_print_templates' ),
			'priority' => 10,
			'num_args' => 0,
		);
		$this->actions[] = array(
			'name'     => 'admin_footer-post-new.php',
			'callback' => array( $this->edit_page_handler, 'maybe_print_templates' ),
			'priority' => 10,
			'num_args' => 0,
		);
		$this->actions[] = array(
			'name'     => "save_post_{$this->get_prefix()}form",
			'callback' => array( $this->edit_page_handler, 'maybe_handle_save_request' ),
			'priority' => 10,
			'num_args' => 1,
		);
		$this->actions[] = array(
			'name'     => "admin_action_{$this->get_prefix()}duplicate_form",
			'callback' => array( $this->edit_page_handler, 'action_duplicate_form' ),
			'priority' => 10,
			'num_args' => 0,
		);
		$this->actions[] = array(
			'name'     => 'admin_notices',
			'callback' => array( $this->edit_page_handler, 'maybe_show_duplicate_form_feedback' ),
			'priority' => 10,
			'num_args' => 0,
		);
		$this->actions[] = array(
			'name'     => 'get_sample_permalink_html',
			'callback' => array( $this->edit_page_handler, 'maybe_add_duplicate_button' ),
			'priority' => 10,
			'num_args' => 5,
		);
		$this->actions[] = array(
			'name'     => 'get_sample_permalink_html',
			'callback' => array( $this->edit_page_handler, 'maybe_add_submissions_button' ),
			'priority' => 10,
			'num_args' => 5,
		);
		$this->actions[] = array(
			'name'     => 'post_submitbox_misc_actions',
			'callback' => array( $this->edit_page_handler, 'maybe_render_shortcode' ),
			'priority' => 10,
			'num_args' => 1,
		);
		$this->actions[] = array(
			'name'     => 'post_edit_form_tag',
			'callback' => array( $this->edit_page_handler, 'maybe_print_post_form_novalidate' ),
			'priority' => 10,
			'num_args' => 1,
		);

		// TODO: Remove these hooks in the future.
		$this->actions[] = array(
			'name'     => 'current_screen',
			'callback' => array( $this, 'maybe_upgrade_legacy_form_meta' ),
			'priority' => 10,
			'num_args' => 1,
		);
		$this->actions[] = array(
			'name'     => 'admin_init',
			'callback' => array( $this, 'maybe_upgrade_legacy_form_attachments' ),
			'priority' => 100,
			'num_args' => 0,
		);
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.