Score:0

Query the database for the value of a ckeditor field

in flag

So I want to QUERY the database for the contents of a field, the trouble is the field is a ckeditor field, so how do I write the condition correctly?

Normally it would be something like this:

$query = \Drupal::entityTypeManager()->getStorage('node')->getQuery();
$query->condition('field_ckeditor_field', $value_to_match); (edited) 

But for CKEditor fields there is a _value and _format column in the db too, I want to make my string to the contents of the _value column.

Any suggestions?

4uk4 avatar
cn flag
The `value` column should be the default if you don't specify a column. You can however query only the raw database content, not how it is formatted according to the `format` column.
RominRonin avatar
in flag
Thanks, I wasn't getting the expected result from the above, but upon reading your comment I investigated further and realised I made a mistake elsewhere, so this does indeed work as you might expect.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.