Closed JDGrimes closed 8 years ago
These are our options with get_title()
:
The first two have the issue that we'd probably want to make this localizable, though since we don't use it we really wouldn't have to. But we'd need to figure out how to handle the fact that most users would probably have no idea what an "array" was.
The last option is really lame, even though we don't use this feature right now. But if we were going to just return nothing, we haven't really implemented the interface, have we? We could actually remove get_title()
from the entityish interface, but that would probably make things worse instead of better. So I think we should pursue actually returning something meaningful from this.
So, if we need to decide how to describe this thing. What word can we use instead of "array"?
"Set" seems the best fitted in my judgement.
We musts also keep in mind that we have only the singular name of the entity, so we can't say "Set of %s", we'd have to say "%s set" instead, which seems strange. "%s collection" seems better.
Let's just go with %s collection
for now.
This fact means that some methods accept WordPoints_EntityishI|WordPoints_Entity_Array, which is quite a mouthful.
Interestingly, most of these methods were documented as accepting WordPoints_EntityishI
specifically, even though some of them could actually get passed entity arrays.
The WordPoints entity API consists mostly of classes which descend from
WordPoints_Entityish
and thus implementWordPoints_EntityishI
. One exception is theWordPoints_Entity_Array
class. This fact means that some methods acceptWordPoints_EntityishI|WordPoints_Entity_Array
, which is quite a mouthful. It would be cleaner if the entity array class was just an entityish, instead of being an odd man out.In order to make that happen, the entity array class will need to implement three methods:
get_the_value()
— Actually, this could be achieved by extendingWordPoints_Entityish
instead of implementing the interface directly.get_slug()
— It would make sense to implement this and have it return"$entity_slug{}"
. This would also give us parity with the JS behind the entities in the UI.get_title()
— This is the hardest one to justify. It doesn't exist because we just don't need it. And because of i18n, it is awkward.The main issue is
get_title()
.