Trait for managers that support child managers.
Description
Source
File: src/db-objects/manager-with-children-trait.php
trait Manager_With_Children_Trait { /** * Child managers. * * @since 1.0.0 * @var array */ protected $child_managers = array(); /** * Adds a child manager. * * @since 1.0.0 * * @param string $slug Child manager identifier. * @param Manager $manager Child manager instance. * @return bool True on success, false on failure. */ public function add_child_manager( $slug, $manager ) { if ( ! is_a( $manager, Manager::class ) ) { return false; } $this->child_managers[ $slug ] = $manager; return true; } /** * Retrieves a child manager. * * @since 1.0.0 * * @param string $slug Child manager identifier. * @return Manager Child manager instance. */ public function get_child_manager( $slug ) { if ( ! isset( $this->child_managers[ $slug ] ) ) { return null; } return $this->child_managers[ $slug ]; } }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |
Methods
- __construct — Constructor.
- add_hooks — Adds the service hooks.
- delete_from_db — Internal method to delete a form from the database.
- edit_page_handler — Returns the form edit page handler.
- fetch_from_db — Internal method to fetch a form from the database.
- frontend_output_handler — Returns the form frontend output handler.
- frontend_submission_handler — Returns the form frontend submission handler.
- insert_into_db — Internal method to insert a new form into the database.
- list_page_handler — Returns the form list page handler.
- map_args — Maps form arguments to regular post arguments.
- maybe_delete_form_subcomponents — Deletes sub-components of a form that is about to be deleted.
- maybe_start_session — Starts a PHP session if the current request is any frontend form request.
- maybe_upgrade_legacy_form_attachments — Upgrades legacy form attachments when the admin is initialized.
- maybe_upgrade_legacy_form_meta — Upgrades legacy form meta when a form is accessed in the admin.
- register_settings — Registers settings for the REST API.
- remove_hooks — Removes the service hooks.
- setup_hooks — Sets up all action and filter hooks for the service.
- update_in_db — Internal method to update an existing form in the database.