@@ -14,65 +14,65 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class Term_Page_Hook { |
| 16 | 16 | |
| 17 | - const HANDLE = 'wl-vocabulary-term-page-handle'; |
|
| 17 | + const HANDLE = 'wl-vocabulary-term-page-handle'; |
|
| 18 | 18 | |
| 19 | - const LOCALIZED_KEY = '_wlVocabularyTermPageSettings'; |
|
| 19 | + const LOCALIZED_KEY = '_wlVocabularyTermPageSettings'; |
|
| 20 | 20 | |
| 21 | - private $term_data_factory; |
|
| 21 | + private $term_data_factory; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Term_Page_Hook constructor. |
|
| 25 | - * |
|
| 26 | - * @param $term_data_factory Term_Data_Factory |
|
| 27 | - */ |
|
| 28 | - public function __construct( $term_data_factory ) { |
|
| 29 | - $this->term_data_factory = $term_data_factory; |
|
| 30 | - } |
|
| 23 | + /** |
|
| 24 | + * Term_Page_Hook constructor. |
|
| 25 | + * |
|
| 26 | + * @param $term_data_factory Term_Data_Factory |
|
| 27 | + */ |
|
| 28 | + public function __construct( $term_data_factory ) { |
|
| 29 | + $this->term_data_factory = $term_data_factory; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - public function connect_hook() { |
|
| 33 | - $taxonomies = Terms_Compat::get_public_taxonomies(); |
|
| 34 | - foreach ( $taxonomies as $taxonomy ) { |
|
| 35 | - add_action( "${taxonomy}_edit_form_fields", array( $this, 'load_scripts' ), 2, PHP_INT_MAX ); |
|
| 36 | - } |
|
| 37 | - } |
|
| 32 | + public function connect_hook() { |
|
| 33 | + $taxonomies = Terms_Compat::get_public_taxonomies(); |
|
| 34 | + foreach ( $taxonomies as $taxonomy ) { |
|
| 35 | + add_action( "${taxonomy}_edit_form_fields", array( $this, 'load_scripts' ), 2, PHP_INT_MAX ); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param $term \WP_Term |
|
| 41 | - */ |
|
| 42 | - public function load_scripts( $term ) { |
|
| 39 | + /** |
|
| 40 | + * @param $term \WP_Term |
|
| 41 | + */ |
|
| 42 | + public function load_scripts( $term ) { |
|
| 43 | 43 | |
| 44 | - $term_data = $this->term_data_factory->get_term_data( $term ); |
|
| 44 | + $term_data = $this->term_data_factory->get_term_data( $term ); |
|
| 45 | 45 | |
| 46 | - Scripts_Helper::enqueue_based_on_wordpress_version( |
|
| 47 | - self::HANDLE, |
|
| 48 | - plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary-term-page', |
|
| 49 | - array( 'react', 'react-dom', 'wp-polyfill', 'wp-i18n' ), |
|
| 50 | - true |
|
| 51 | - ); |
|
| 46 | + Scripts_Helper::enqueue_based_on_wordpress_version( |
|
| 47 | + self::HANDLE, |
|
| 48 | + plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary-term-page', |
|
| 49 | + array( 'react', 'react-dom', 'wp-polyfill', 'wp-i18n' ), |
|
| 50 | + true |
|
| 51 | + ); |
|
| 52 | 52 | |
| 53 | - wp_enqueue_style( self::HANDLE, plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary-term-page.full.css' ); |
|
| 53 | + wp_enqueue_style( self::HANDLE, plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary-term-page.full.css' ); |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | - $term_data_arr = $term_data->get_data(); |
|
| 56 | + $term_data_arr = $term_data->get_data(); |
|
| 57 | 57 | |
| 58 | - $term_data_arr['entities'] = Entity_List_Utils::mark_is_active_for_entities( $term->term_id, $term_data_arr['entities'] ); |
|
| 58 | + $term_data_arr['entities'] = Entity_List_Utils::mark_is_active_for_entities( $term->term_id, $term_data_arr['entities'] ); |
|
| 59 | 59 | |
| 60 | - wp_localize_script( self::HANDLE, self::LOCALIZED_KEY, array( |
|
| 61 | - 'termData' => $term_data_arr, |
|
| 62 | - 'apiConfig' => Api_Config::get_api_config(), |
|
| 63 | - 'restUrl' => get_rest_url( null, Api_Config::REST_NAMESPACE . '/search-entity/' ), |
|
| 64 | - 'nonce' => wp_create_nonce( 'wp_rest' ), |
|
| 65 | - ) ); |
|
| 60 | + wp_localize_script( self::HANDLE, self::LOCALIZED_KEY, array( |
|
| 61 | + 'termData' => $term_data_arr, |
|
| 62 | + 'apiConfig' => Api_Config::get_api_config(), |
|
| 63 | + 'restUrl' => get_rest_url( null, Api_Config::REST_NAMESPACE . '/search-entity/' ), |
|
| 64 | + 'nonce' => wp_create_nonce( 'wp_rest' ), |
|
| 65 | + ) ); |
|
| 66 | 66 | |
| 67 | - echo "<tr class=\"form-field\"> |
|
| 67 | + echo "<tr class=\"form-field\"> |
|
| 68 | 68 | <th>Match</th> |
| 69 | 69 | <td style='width: 100%;' id='wl_vocabulary_terms_widget'></td> |
| 70 | 70 | </tr>"; |
| 71 | 71 | |
| 72 | - echo "<tr class=\"form-field\"> |
|
| 72 | + echo "<tr class=\"form-field\"> |
|
| 73 | 73 | <th></th> |
| 74 | 74 | <td id='wl_vocabulary_terms_autocomplete_select'></td></tr>"; |
| 75 | 75 | |
| 76 | - } |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | 78 | } |
@@ -25,44 +25,44 @@ |
||
| 25 | 25 | * |
| 26 | 26 | * @param $term_data_factory Term_Data_Factory |
| 27 | 27 | */ |
| 28 | - public function __construct( $term_data_factory ) { |
|
| 28 | + public function __construct($term_data_factory) { |
|
| 29 | 29 | $this->term_data_factory = $term_data_factory; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function connect_hook() { |
| 33 | 33 | $taxonomies = Terms_Compat::get_public_taxonomies(); |
| 34 | - foreach ( $taxonomies as $taxonomy ) { |
|
| 35 | - add_action( "${taxonomy}_edit_form_fields", array( $this, 'load_scripts' ), 2, PHP_INT_MAX ); |
|
| 34 | + foreach ($taxonomies as $taxonomy) { |
|
| 35 | + add_action("${taxonomy}_edit_form_fields", array($this, 'load_scripts'), 2, PHP_INT_MAX); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * @param $term \WP_Term |
| 41 | 41 | */ |
| 42 | - public function load_scripts( $term ) { |
|
| 42 | + public function load_scripts($term) { |
|
| 43 | 43 | |
| 44 | - $term_data = $this->term_data_factory->get_term_data( $term ); |
|
| 44 | + $term_data = $this->term_data_factory->get_term_data($term); |
|
| 45 | 45 | |
| 46 | 46 | Scripts_Helper::enqueue_based_on_wordpress_version( |
| 47 | 47 | self::HANDLE, |
| 48 | - plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary-term-page', |
|
| 49 | - array( 'react', 'react-dom', 'wp-polyfill', 'wp-i18n' ), |
|
| 48 | + plugin_dir_url(dirname(dirname(__DIR__))).'js/dist/vocabulary-term-page', |
|
| 49 | + array('react', 'react-dom', 'wp-polyfill', 'wp-i18n'), |
|
| 50 | 50 | true |
| 51 | 51 | ); |
| 52 | 52 | |
| 53 | - wp_enqueue_style( self::HANDLE, plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary-term-page.full.css' ); |
|
| 53 | + wp_enqueue_style(self::HANDLE, plugin_dir_url(dirname(dirname(__DIR__))).'js/dist/vocabulary-term-page.full.css'); |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | $term_data_arr = $term_data->get_data(); |
| 57 | 57 | |
| 58 | - $term_data_arr['entities'] = Entity_List_Utils::mark_is_active_for_entities( $term->term_id, $term_data_arr['entities'] ); |
|
| 58 | + $term_data_arr['entities'] = Entity_List_Utils::mark_is_active_for_entities($term->term_id, $term_data_arr['entities']); |
|
| 59 | 59 | |
| 60 | - wp_localize_script( self::HANDLE, self::LOCALIZED_KEY, array( |
|
| 60 | + wp_localize_script(self::HANDLE, self::LOCALIZED_KEY, array( |
|
| 61 | 61 | 'termData' => $term_data_arr, |
| 62 | 62 | 'apiConfig' => Api_Config::get_api_config(), |
| 63 | - 'restUrl' => get_rest_url( null, Api_Config::REST_NAMESPACE . '/search-entity/' ), |
|
| 64 | - 'nonce' => wp_create_nonce( 'wp_rest' ), |
|
| 65 | - ) ); |
|
| 63 | + 'restUrl' => get_rest_url(null, Api_Config::REST_NAMESPACE.'/search-entity/'), |
|
| 64 | + 'nonce' => wp_create_nonce('wp_rest'), |
|
| 65 | + )); |
|
| 66 | 66 | |
| 67 | 67 | echo "<tr class=\"form-field\"> |
| 68 | 68 | <th>Match</th> |