-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21825 from Yoast/327-create-the-rest-of-the-scrip…
…t-data-disabled-indexables-nonces-etc Add dashboard configuration object.
- Loading branch information
Showing
15 changed files
with
267 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
src/dashboard/application/configuration/dashboard-configuration.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
|
||
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong | ||
namespace Yoast\WP\SEO\Dashboard\Application\Configuration; | ||
|
||
use Yoast\WP\SEO\Dashboard\Application\Content_Types\Content_Types_Repository; | ||
use Yoast\WP\SEO\Editors\Application\Analysis_Features\Enabled_Analysis_Features_Repository; | ||
use Yoast\WP\SEO\Editors\Framework\Keyphrase_Analysis; | ||
use Yoast\WP\SEO\Editors\Framework\Readability_Analysis; | ||
use Yoast\WP\SEO\Helpers\Indexable_Helper; | ||
use Yoast\WP\SEO\Helpers\User_Helper; | ||
|
||
/** | ||
* Responsible for the dashboard configuration. | ||
*/ | ||
class Dashboard_Configuration { | ||
|
||
/** | ||
* The content types repository. | ||
* | ||
* @var Content_Types_Repository $content_types_repository | ||
*/ | ||
private $content_types_repository; | ||
|
||
/** | ||
* The indexable helper. | ||
* | ||
* @var Indexable_Helper $indexable_helper | ||
*/ | ||
private $indexable_helper; | ||
|
||
/** | ||
* The user helper. | ||
* | ||
* @var User_Helper $user_helper | ||
*/ | ||
private $user_helper; | ||
|
||
/** | ||
* The repository. | ||
* | ||
* @var Enabled_Analysis_Features_Repository | ||
*/ | ||
private $enabled_analysis_features_repository; | ||
|
||
/** | ||
* The constructor. | ||
* | ||
* @param Content_Types_Repository $content_types_repository The content types repository. | ||
* @param Indexable_Helper $indexable_helper The indexable helper | ||
* repository. | ||
* @param User_Helper $user_helper The user helper. | ||
* @param Enabled_Analysis_Features_Repository $enabled_analysis_features_repository The analysis feature | ||
* repository. | ||
*/ | ||
public function __construct( | ||
Content_Types_Repository $content_types_repository, | ||
Indexable_Helper $indexable_helper, | ||
User_Helper $user_helper, | ||
Enabled_Analysis_Features_Repository $enabled_analysis_features_repository | ||
) { | ||
$this->content_types_repository = $content_types_repository; | ||
$this->indexable_helper = $indexable_helper; | ||
$this->user_helper = $user_helper; | ||
$this->enabled_analysis_features_repository = $enabled_analysis_features_repository; | ||
} | ||
|
||
/** | ||
* Returns a configuration | ||
* | ||
* @return array<string,array<string>> | ||
*/ | ||
public function get_configuration(): array { | ||
return [ | ||
'contentTypes' => $this->content_types_repository->get_content_types(), | ||
'indexablesEnabled' => $this->indexable_helper->should_index_indexables(), | ||
'displayName' => $this->user_helper->get_current_user_display_name(), | ||
'enabledAnalysisFeatures' => $this->enabled_analysis_features_repository->get_features_by_keys( | ||
[ | ||
Readability_Analysis::NAME, | ||
Keyphrase_Analysis::NAME, | ||
] | ||
)->to_array(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.