- Issue created by @penyaskito
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
Improved wording. Added STR.
- πΊπΈUnited States DamienMcKenna NH, USA
That seems entirely reasonable.
At a surface level we should make sure that the Image object does not output if the URL value is empty.
We should (separately) look at whether it would be possible to indicate required values that would cause the structure to not be output at all if they are not present.
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
@DamienMcKenna I was wondering if it would make sense to introduce e.g. a SchemaImageObjectBase class, and try to imitate more accurately the types specificity of Schema.org Types instead of all tags inheriting from SchemaNameBase. But yes, definitely out of scope here.
- Status changed to Needs review
almost 2 years ago 2:37am 7 February 2023 - πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
Well, maybe not that out of scope. I'm pretty sure I will encounter the same issue if I test HowTo schemas. This should fix all.
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
+++ b/src/Plugin/metatag/Tag/SchemaImageObjectBase.php @@ -0,0 +1,32 @@ + public function output(): array { ... + return '';
This is problematic. We use empty string, but the function contract returned value is array.
This is already a problem in HEAD withSchemaNameBase::output()
I'm using 2.4 so this might work for me, but definitely we need a different solution here.
- πΊπΈUnited States DamienMcKenna NH, USA
That's pretty good, thank you.
What happens if it returns an empty array instead of an empty string?
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
Ah, it actually works, wasn't 100% confident.
-
DamienMcKenna β
committed 0ca7b92b on 8.x-2.x authored by
penyaskito β
Issue #3339740 by penyaskito, DamienMcKenna: If SchemaArticleImage url...
-
DamienMcKenna β
committed 0ca7b92b on 8.x-2.x authored by
penyaskito β
- Status changed to Fixed
over 1 year ago 1:45pm 20 June 2023 -
DamienMcKenna β
committed c91a4fdd on 3.0.x authored by
penyaskito β
Issue #3339740 by penyaskito, DamienMcKenna: If SchemaArticleImage url...
-
DamienMcKenna β
committed c91a4fdd on 3.0.x authored by
penyaskito β
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
+++ b/src/Plugin/metatag/Tag/SchemaImageObjectBase.php @@ -0,0 +1,32 @@ +/** ... + */ +class SchemaImageObjectBase extends SchemaNameBase {
Just found that I copypasted this and the comment should say
All Schema.org **images** should extend this class.
-
DamienMcKenna β
committed 58153dc5 on 3.0.x authored by
penyaskito β
Issue #3339740 by penyaskito, DamienMcKenna: Corrected...
-
DamienMcKenna β
committed 58153dc5 on 3.0.x authored by
penyaskito β
-
DamienMcKenna β
committed 23fd6279 on 8.x-2.x authored by
penyaskito β
Issue #3339740 by penyaskito, DamienMcKenna: Corrected...
-
DamienMcKenna β
committed 23fd6279 on 8.x-2.x authored by
penyaskito β
- πΊπΈUnited States DamienMcKenna NH, USA
Committed. Thanks for the follow-up.
Automatically closed - issue fixed for 2 weeks with no activity.