Having Issue Attaching Image Page Attribute to Theme Package
Permalink
I am working on a theme package where an image page attribute is included with a specific page type.
The theme installs ok, but when I go to check if the page type includes the image attribute immediately after installation, it is not checked (and so is not included by default with the page type).
I must be doing something wrong in the controller. Below is the code I have for assigning the image page attribute to the page type (called "cv").
How do I fix this so the image attribute is always included by default with the "cv" page type by default, upon installation of the package?
The theme installs ok, but when I go to check if the page type includes the image attribute immediately after installation, it is not checked (and so is not included by default with the page type).
I must be doing something wrong in the controller. Below is the code I have for assigning the image page attribute to the page type (called "cv").
$ift = AttributeType::getByHandle('image_file'); $headshotImageAttr=CollectionAttributeKey::getByHandle('headshot_image'); if( !is_object($headshotImageAttr) ){ CollectionAttributeKey::add($ift, array('akHandle' => 'headshot_image', 'akName' => t('Headshot Image'), 'akIsSearchable' => false),$pkg); $pageType = CollectionType::getByHandle('cv'); $ak= CollectionAttributeKey::getbyHandle('headshot_image'); $pageType->assignCollectionAttribute($ak); }
How do I fix this so the image attribute is always included by default with the "cv" page type by default, upon installation of the package?