How can I detect if the result of, say, metadata('item',array('Dublin Core', 'Relation'))
is HTML? That is, if the user has checked the HTML box for the element text?
EDIT: ...other than by regex or other analysis of the output after the fact.
How can I detect if the result of, say, metadata('item',array('Dublin Core', 'Relation'))
is HTML? That is, if the user has checked the HTML box for the element text?
EDIT: ...other than by regex or other analysis of the output after the fact.
Hmm...might be able to dig it up with $item->getElementTexts()
, but that could be weird if there is more than one value.
What's the outcome you are shooting for? It might make more sense to use a filter on the text?
I'm just doing a data migration/batch-edit, so I was looking for boolean values to use in update_item()
. If there's not a standard way of doing so, I'll just use something like the following:
$relation = metadata($item, array('Dublin Core', 'Relation'))
$use_html = ( strlen($relation) != strlen(strip_tags($relation)) ) ? true : false;
The basic purpose of metadata
is for output of data, so it internally handles the HTML flag.
If the current setting of the flag is important, I think it would be better to directly get at the ElementText record(s) with a $item->getElementTexts('Dublin Core', 'Relation')
call, as Patrick mentioned. Those records would have both the raw text data as we've saved it, and the HTML flag setting.