1

I am attempting to read out the entry field attributes by using the attributeConfigs array of the EntryModel.

When I review the EntryModel object, using id and title as an example. I request the attribute configs like this:

    $entry->attributeConfigs['id'] // Works
    $entry->attributeConfigs['title'] // Undefined index error

All though the index exists in the array

    [_attributeConfigs:Craft\ContentModel:private] => Array
    (
        [id] => Array
            (
                [maxLength] => 11
                [min] => -2147483648
                [max] => 2147483647
                [decimals] => 0
                [type] => number
                [unsigned] => 
                [length] => 10
                [column] => integer
            )

        [title] => Array
            (
                [required] => 
                [maxLength] => 255
                [label] => Title
                [type] => string
            )

Is there any way I can access these configurations?

0

An entry's title is stored on the ContentModel, so you'd need to do:

$content = $entry->getContent();
$content->attributeConfigs['title'];

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.