| 1 |
<?php |
| 2 |
/** |
| 3 |
* API Endpoint: Dashboard Widget Settings |
| 4 |
* |
| 5 |
* @package Parsely |
| 6 |
* @since 3.17.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
declare(strict_types=1); |
| 10 |
|
| 11 |
namespace Parsely\REST_API\Settings; |
| 12 |
|
| 13 |
/** |
| 14 |
* Endpoint for saving and retrieving Content Intelligence Dashboard Widget |
| 15 |
* settings. |
| 16 |
* |
| 17 |
* @since 3.17.0 |
| 18 |
* |
| 19 |
* @phpstan-import-type Subvalue_Spec from Base_Settings_Endpoint |
| 20 |
*/ |
| 21 |
class Endpoint_Dashboard_Widget_Settings extends Base_Settings_Endpoint { |
| 22 |
/** |
| 23 |
* Returns the endpoint's name. |
| 24 |
* |
| 25 |
* @since 3.17.0 |
| 26 |
* |
| 27 |
* @return string |
| 28 |
*/ |
| 29 |
public static function get_endpoint_name(): string { |
| 30 |
return 'dashboard-widget'; |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Returns the meta entry's key. |
| 35 |
* |
| 36 |
* @since 3.13.0 |
| 37 |
* @since 3.17.0 Moved from Dashboard_Widget_Settings_Endpoint. |
| 38 |
* |
| 39 |
* @return string The meta entry's key. |
| 40 |
*/ |
| 41 |
protected function get_meta_key(): string { |
| 42 |
return 'parsely_content_helper_settings_dashboard_widget'; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Returns the endpoint's subvalues specifications. |
| 47 |
* |
| 48 |
* @since 3.13.0 |
| 49 |
* @since 3.17.0 Moved from Dashboard_Widget_Settings_Endpoint. |
| 50 |
* |
| 51 |
* @return array<string, Subvalue_Spec> |
| 52 |
*/ |
| 53 |
protected function get_subvalues_specs(): array { |
| 54 |
return array( |
| 55 |
'Metric' => array( |
| 56 |
'values' => array( 'views', 'avg_engaged' ), |
| 57 |
'default' => 'views', |
| 58 |
), |
| 59 |
'Period' => array( |
| 60 |
'values' => array( '10m', '1h', '2h', '4h', '24h', '7d', '30d' ), |
| 61 |
'default' => '7d', |
| 62 |
), |
| 63 |
); |
| 64 |
} |
| 65 |
} |
| 66 |
|