1

When I get an Entry Object that has been set, I notice all of my fields except the Category fields are available to me. For example:

[_behaviors:yii\base\Component:private] => Array
    (
        [customFields] => craft\behaviors\ContentBehavior Object
            (
                [adjustedRemainingLife] => 100%
                [adjustedRemainingYears] => 116
                [answerSets] => [{"col3":"Paving and curbs are less than 3 years old, and in good condition. No repairs are needed, preventative maintenance ","col1":"Paving and curbs are in good condition, and only require routine maintenance - 90%","col2":"Minor repairs and patching are required, not exceeding 30% of value -\r\n60%","col4":"Significant repairs are needed to as much as 60% of value. - 30%","col5":"All or majority of systems should be replaced - 0%"}]
                [groundsQuestions] =>

Where groundsQuestions is my category field, I figure if it isn't flowing through, there must be some way to get that value in a plugin?

2

1 Answer 1

1

Since groundsQuestions is a category field, calling it will return an element query on which you can call one(), all(), etc.

For example:

$groundsQuestions = $entry->groundsQuestions->all();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.