Working with Attributes - how to get options from a Select Attribute

Permalink
Hi,

Working on Concrete5.7.2, I am trying to get options from a Select Attribute that I have created.

I tried the code example on this page:http://www.webli.us/cheatsheet/doku.php#display_get_options_from_a_...
- but it fails with the following message: Class 'SelectAttributeTypeController' not found

Obviously this part isn't correct or working on 5.7.2:
$sa = new SelectAttributeTypeController(AttributeType::getByHandle('select'));


How can I do this in 5.7.2?

Thanks!
Sami

View Replies:
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi Sami,

Just to clarify - you made a select attribute, added it to a page type, and want to know how to access it?
BermudaSam replied on at Permalink Reply
Basically, yes. In other words, I am trying to print out ALL the options attached to the Select Attribute itself, and not the selected options it may have on a Page that it utilizes the attribute.
senshidigital replied on at Permalink Reply
senshidigital
hey BermudaSam

did you find a solution for this? I'm trying to do the same
surefyre replied on at Permalink Reply
surefyre
Same here. Keep getting

Argument 1 passed to Concrete\Core\Attribute\Controller::__construct() must be an instance of Doctrine\ORM\EntityManager, instance of DoctrineProxies\__CG__\Concrete\Core\Entity\Attribute\Type given, called in /var/www/c5/concrete5-8.1.0/packages/firstforwellbeing/controllers/single_page/ffw/pathways.php on line 32

When following other half-complete examples I'm trying to scavenge documentation from
surefyre replied on at Permalink Reply
surefyre
Here, finally I got it, took WAY too long searching and trying to piece together clues. I get a bit fed up of feeling like Indiana Jones when trying to get simple things done in C5 some days.

This will get you the available options from a user attribute key (in my case, collections should be the same bar changing UserKey hopefully).

$attr = \Concrete\Core\Attribute\Key\UserKey::getByHandle('userprovidertype');
        $atc = $attr->getController();
        $options = $atc->getOptions();