| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Integrations\Third_Party; |
| 4 |
|
| 5 |
use Yoast\WP\SEO\Conditionals\Admin\Post_Conditional; |
| 6 |
use Yoast\WP\SEO\Conditionals\Web_Stories_Conditional; |
| 7 |
use Yoast\WP\SEO\Integrations\Integration_Interface; |
| 8 |
|
| 9 |
/** |
| 10 |
* Web Stories integration. |
| 11 |
*/ |
| 12 |
class Web_Stories_Post_Edit implements Integration_Interface { |
| 13 |
|
| 14 |
/** |
| 15 |
* Returns the conditionals based in which this loadable should be active. |
| 16 |
* |
| 17 |
* @return array |
| 18 |
*/ |
| 19 |
public static function get_conditionals() { |
| 20 |
return [ Web_Stories_Conditional::class, Post_Conditional::class ]; |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* Initializes the integration. |
| 25 |
* |
| 26 |
* This is the place to register hooks and filters. |
| 27 |
* |
| 28 |
* @return void |
| 29 |
*/ |
| 30 |
public function register_hooks() { |
| 31 |
\add_filter( 'wpseo_admin_l10n', [ $this, 'add_admin_l10n' ] ); |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Adds a isWebStoriesIntegrationActive variable to the Adminl10n array. |
| 36 |
* |
| 37 |
* @param array $input The array to add the isWebStoriesIntegrationActive to. |
| 38 |
* |
| 39 |
* @return array The passed array with the additional isWebStoriesIntegrationActive variable set to 1 if we are editing a web story. |
| 40 |
*/ |
| 41 |
public function add_admin_l10n( $input ) { |
| 42 |
if ( \get_post_type() === 'web-story' ) { |
| 43 |
$input['isWebStoriesIntegrationActive'] = 1; |
| 44 |
} |
| 45 |
return $input; |
| 46 |
} |
| 47 |
} |
| 48 |
|