Retrieving a list of all page attributes
Permalink
I want to have a list of the attributes that are currently setup in the system, so that I can choose the attribute handle of one of them. I dont want the available choices in a particular attribute.
I have a block, and in my block I have to specify an attribute handle of a (select)attribute I want to choose/use in the block editing. I currently just have a text field, which I fill in the attribute handle, and that works fine. To make it more user friendly, I want to make a dropdown, populated with attribute handles I can choose from.
How would I go about doing something like this??
Any help would be much appreciated! Thanks, Andrew
I have a block, and in my block I have to specify an attribute handle of a (select)attribute I want to choose/use in the block editing. I currently just have a text field, which I fill in the attribute handle, and that works fine. To make it more user friendly, I want to make a dropdown, populated with attribute handles I can choose from.
How would I go about doing something like this??
Any help would be much appreciated! Thanks, Andrew
I also dont see how I can know, from within the block controller, what block id it is.... Im so confused today =/
I've settled on this for now. It does not give me kackage or block secific attributes, but in my application it could be possible to use ANY Select attribute to populate my block.
CONTROLLER in the edit() method:
In the edit/add files:
CONTROLLER in the edit() method:
Loader::model('attribute/key') $keyslist = AttributeKey::getList('Collection'); $available_aks=array(''=>'(none)'); foreach($keyslist AS $key){ if( $key->getAttributeType()->getAttributeTypeName() == 'Select' ){ $available_aks["{$key->akHandle}"] = $key->akName; } } $this->set('available_aks', $available_aks );
In the edit/add files:
//This is not working (C5 v5.6) - 'Collection' needs to be in lower case letters AttributeKey::getList('Collection'); //This works AttributeKey::getList('collection');
I see that If I print_r the actual attribute objects, there is a pkgId value. If I could know what that pkgId is I could do something like this, which would return the attributes created in the package (more ideal situation!)
I dont see how I can know, from within the block controller, what package that block belongs to??