add attribute (type select) from package
Permalink 2 users found helpful
Hi i'm looking to found how to add a select page attribute from package
for the boolean one i made like this in controller.php file:
just to add a bolean choice, with no search and not activ by default.
But to add a select one with some values inside (no search and not by default) i didn't find anywhere how to set it.
is someone could help me ?
thanks.
cali
for the boolean one i made like this in controller.php file:
Loader::model('collection_attributes'); $ExempleAttrKey=CollectionAttributeKey::getByHandle('exemple'); if( !$ExempleAttrKey || !intval($ExempleAttrKey->getAttributeKeyID()) ) $ExempleAttrKey = CollectionAttributeKey::add('exemple', t('what this attribute doing'), false, null, 'BOOLEAN');
just to add a bolean choice, with no search and not activ by default.
But to add a select one with some values inside (no search and not by default) i didn't find anywhere how to set it.
is someone could help me ?
thanks.
cali
Hey,
How should i create user attribute at install method of a package?
I want a boolean type.
How should i create user attribute at install method of a package?
I want a boolean type.
I use this code to create a user attribute, it worked out:
$booleann = AttributeType::getByHandle('boolean'); Loader::model('user_attributes'); UserAttributeKey::add($booleann, array( 'akHandle' => 'my_handle', 'akName' => t('Attr Desc'), 'akIsSearchable' => true, 'akCheckedByDefault' => true ) );
I am hoping to get a better understanding of this, but I need to take a few steps back...
Let's say I want to add Page Attributes and Sets to a C5 install via Packages...
As far as I understand it, I would:
1) Copy "controller.php"? Which controller? Is it "root/concrete/controllers/page_types/core_stack.php"?
2) Add in my new attributes into that controller, then add it to "packages"? I assume that it needs to mime the same directory structure so that it knows where to put it?
If someone could point me in the right direction, that would be huge help. Thanks!
Let's say I want to add Page Attributes and Sets to a C5 install via Packages...
As far as I understand it, I would:
1) Copy "controller.php"? Which controller? Is it "root/concrete/controllers/page_types/core_stack.php"?
2) Add in my new attributes into that controller, then add it to "packages"? I assume that it needs to mime the same directory structure so that it knows where to put it?
If someone could point me in the right direction, that would be huge help. Thanks!
BTW: I know I can add this stuff in through the admin, I am just hoping to find a quicker, programmatic solution. Thanks.
there is one way to install page attributes with your package:
explanation by example, not hard to understand.