Caldera_Forms_API_Settings

REST API route for settings.

Defined (1)

The class is defined in the following location(s).

/classes/api/settings.php  
  1. class Caldera_Forms_API_Settings implements Caldera_Forms_API_Route{ 
  2.  
  3. /** 
  4. * @since 1.5.0 
  5. * @inheritdoc 
  6. */ 
  7. public function add_routes( $namespace ) { 
  8. register_rest_route( $namespace, '/settings/entries',  
  9. array( 
  10. 'methods' => array( 'POST' ),  
  11. 'callback' => array( $this, 'update_entry_settings' ),  
  12. 'permission_callback' => array( $this, 'permissions_check' ),  
  13. 'args' => array( 
  14. 'per_page' => array( 
  15. 'required' => 'false',  
  16. 'type' => 'integer',  
  17. ); 
  18.  
  19.  
  20. /** 
  21. * Update entry settings 
  22. * @since 1.5.0 
  23. * @param WP_REST_Request $request 
  24. * @return Caldera_Forms_API_Response 
  25. */ 
  26. public function update_entry_settings( WP_REST_Request $request ) { 
  27. Caldera_Forms_Entry_Viewer::update_entries_per_page( $request[ 'per_page' ] ); 
  28. $response = new Caldera_Forms_API_Response( array( 
  29. 'per_page' => Caldera_Forms_Entry_Viewer::entries_per_page() 
  30. )); 
  31. return $response; 
  32.  
  33.  
  34.  
  35.