balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

sub-endpoint.php (753B)


      1 <?php
      2 namespace Elementor\Data\Base;
      3 
      4 // TODO: Add test.
      5 
      6 abstract class SubEndpoint extends Endpoint {
      7 
      8 	/**
      9 	 * @var Endpoint
     10 	 */
     11 	protected $parent_endpoint;
     12 
     13 	/**
     14 	 * @var string
     15 	 */
     16 	protected $parent_route = '';
     17 
     18 	public function __construct( $parent_route, $parent_endpoint ) {
     19 		$this->parent_endpoint = $parent_endpoint;
     20 		$this->parent_route = $parent_route;
     21 
     22 		parent::__construct( $this->parent_endpoint->controller );
     23 	}
     24 
     25 	/**
     26 	 * Get parent route.
     27 	 *
     28 	 * @return \Elementor\Data\Base\Endpoint
     29 	 */
     30 	public function get_parent() {
     31 		return $this->parent_endpoint;
     32 	}
     33 
     34 	public function get_base_route() {
     35 		$controller_name = $this->controller->get_name();
     36 
     37 		return $controller_name . '/' . $this->parent_route . $this->get_name();
     38 	}
     39 }