-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin: Fix wp translation access #1711
base: master
Are you sure you want to change the base?
Plugin: Fix wp translation access #1711
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1711 +/- ##
============================================
- Coverage 54.08% 53.82% -0.27%
- Complexity 2628 2631 +3
============================================
Files 98 98
Lines 11655 11675 +20
============================================
- Hits 6304 6284 -20
- Misses 5351 5391 +40 ☔ View full report in Codecov by Sentry. |
@@ -976,7 +1013,7 @@ public function getTheContent( $content ): string { | |||
// Check if we're inside the main loop in a single post page. | |||
if ( is_single() && in_the_loop() && is_main_query() ) { | |||
global $post; | |||
foreach ( self::getCustomPostTypes() as $customPostType ) { | |||
foreach ( self::getCustomPostTypeClasses() as $customPostType ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hier würde ich den Call auf getCustomPostTypes beibehalten und dafür den Call in #L1017 auf getPostType rausnehmen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wobei das geht nicht, unten wird ja noch getView aufgerufen.
src/Plugin.php
Outdated
@@ -156,19 +156,56 @@ public static function addCustomUserRoles() { | |||
* All CustomPostType classes extend the CustomPostType class and must be registered in this method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Die Dokumentation muss jetzt auf die getCustomPostTypeClasses Methode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mh an sich stimmt die Beschreibung ja noch für die Methode. Ich persönlich finde den den Ort im Plugin.php eher etwas unschön.
Ich habe mal noch auf die Classes Methode verwiesen.
5ec121a
to
dd5e584
Compare
Uses static access on $postType variable * Refactors methods to use class-string based lists instead of objects of custom post types.
diff --git a/tests/php/PluginTest.php b/tests/php/PluginTest.php index e04f2329..ce7bfd02 100644 --- a/tests/php/PluginTest.php +++ b/tests/php/PluginTest.php @@ -18,8 +18,8 @@ class PluginTest extends CustomPostTypeTest { // first, create a post of this type $post = wp_insert_post( [ - 'post_type' => $customPostType::getPostType(), - 'post_title' => 'Test ' . $customPostType::getPostType(), + 'post_type' => $customPostType, + 'post_title' => 'Test ' . $customPostType, 'post_status' => 'publish', ] );
dd5e584
to
b46cc7d
Compare
Closes #1710
Before, it unnecessarily initialized all CustomPostType classes, even when static access was sufficient.
Now uses static access on $postType variable