File tree Expand file tree Collapse file tree 4 files changed +27
-14
lines changed
plugins/system/opengraph/src Expand file tree Collapse file tree 4 files changed +27
-14
lines changed Original file line number Diff line number Diff line change @@ -107,3 +107,5 @@ cypress.config.mjs
107107
108108# WebAuthn FIDO metadata cache
109109/plugins /system /webauthn /fido.jwt
110+
111+ /plugins /fields /ogtest
Original file line number Diff line number Diff line change @@ -81,5 +81,5 @@ interface MappableFieldInterface
8181 *
8282 * @since __DEPLOY_VERSION__
8383 */
84- public function getOpengraphGroup (): OpengraphGroup ;
84+ public static function getOpengraphGroup (): OpengraphGroup ;
8585}
Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ public function onBeforeCompileHead(BeforeCompileHeadEvent $event): void
265265 ['ignore_request ' => true ]
266266 );
267267 $ categoryModel ->setState ('category.id ' , $ article ->catid );
268- $ category = $ categoryModel ->getItem ( $ article -> catid );
268+ $ category = $ categoryModel ->getCategory ( );
269269
270270
271271
Original file line number Diff line number Diff line change @@ -113,18 +113,29 @@ protected function getGroups()
113113
114114 // If not native-allowed, see if the field’s plugin implements our interface
115115 if (!$ accept ) {
116- // Class name convention: PlgFields{Type}
117- $ class = 'PlgFields ' . ucfirst ($ field ->type );
118-
119- // Ensure plugin autoloaded
120- PluginHelper::importPlugin ('fields ' );
121-
122- if (
123- \class_exists ($ class )
124- && \is_subclass_of ($ class , MappableFieldInterface::class)
125- && $ class ::getOpengraphGroup ()->value === $ fieldType
126- ) {
127- $ accept = true ;
116+
117+ // Ensure the specific fields plugin is loaded
118+ PluginHelper::importPlugin ('fields ' , $ field ->type );
119+
120+ $ ucType = ucfirst ((string ) $ field ->type );
121+
122+ // Candidate class names in priority order (modern first, then legacy)
123+ $ candidates = [
124+ "Joomla \\Plugin \\Fields \\{$ ucType }\\Extension \\{$ ucType }" , // J4/5 namespaced
125+ "Joomla \\Plugin \\Fields \\{$ ucType }\\Field \\{$ ucType }Field " , // some third-party patterns
126+ "PlgFields {$ ucType }" , // legacy non-namespaced
127+ ];
128+
129+ $ implements = false ;
130+
131+ foreach ($ candidates as $ fqcn ) {
132+ if (\class_exists ($ fqcn ) && \is_subclass_of ($ fqcn , MappableFieldInterface::class)) {
133+ $ implements = ($ fqcn ::getOpengraphGroup ()->value === $ fieldType );
134+ if ($ implements ) {
135+ $ accept = true ;
136+ break ;
137+ }
138+ }
128139 }
129140 }
130141
You can’t perform that action at this time.
0 commit comments