Jump to content


Photo

How to add the imageGalleries module by customization

imageGalleries customization

  • Please log in to reply
12 replies to this topic

#1 k1000o

k1000o

    Advanced Member

  • Members
  • PipPipPip
  • 112 posts
  • LocationMadrid

Posted 07 February 2012 - 10:27 PM

After configuring the imageGalleries module we can go to the Admin->Image gallery section to manually associate it to another module.
How can we predefine the association in the views and model so it already exists after installation.

#2 Jason

Jason

    Administrator

  • Administrators
  • 864 posts
  • LocationChicago

Posted 08 February 2012 - 01:57 PM

Look at CustomManagement. Extend this class and override the runAfterInstallationDefaultDataLoad method. Then you can execute your logic to load into the config. Hopefully this helps.

Jason Green
Zurmo Team
Need support? Upgrade now


#3 k1000o

k1000o

    Advanced Member

  • Members
  • PipPipPip
  • 112 posts
  • LocationMadrid

Posted 08 February 2012 - 07:56 PM

After reading the code I found what does the ImageGalleriesConfigurationUtil->actionRelateToDetailsAndRelationsView so prefered to do it manually in the DetailsAndRelationsView adding the following entry under leftBottomView

'leftBottomView' => array(
	'showAsTabbed' => true,
	'columns' => array(
		array(
			'rows' => array(
				array(
					'type' => 'ImageCreateAndThumbnails',
				)
			)
		)
	)
),

Et voila, it's working

#4 Jason

Jason

    Administrator

  • Administrators
  • 864 posts
  • LocationChicago

Posted 08 February 2012 - 10:17 PM

Ah yes, that is actually the best practice approach because the module you are adding it to is your own. If you were doing something to a standard module, than the approach i recommended is better so the module stays upgrade safe.

Jason Green
Zurmo Team
Need support? Upgrade now


#5 k1000o

k1000o

    Advanced Member

  • Members
  • PipPipPip
  • 112 posts
  • LocationMadrid

Posted 18 February 2012 - 06:51 PM

Can you provide a small example on how to use CustomManagement ?

#6 Jason

Jason

    Administrator

  • Administrators
  • 864 posts
  • LocationChicago

Posted 19 February 2012 - 03:32 PM

http://hg.zurmo.org/...mManagement.php

You can see from the class above, it overrides CustomManagement. Then in the methods it calls

ZurmoZooInstallUtil::resolveCustomMetadataAndLoad();



http://hg.zurmo.org/...InstallUtil.php

The above link shows that method how it loads up the metadata. Hopefully this helps.

Jason Green
Zurmo Team
Need support? Upgrade now


#7 k1000o

k1000o

    Advanced Member

  • Members
  • PipPipPip
  • 112 posts
  • LocationMadrid

Posted 20 February 2012 - 06:56 PM

Once we retrieve the metadata does the framework provide some functions to add fields? or labels? etc... or do we have to implement them managing the array?

#8 Jason

Jason

    Administrator

  • Administrators
  • 864 posts
  • LocationChicago

Posted 20 February 2012 - 09:35 PM

It depends, with the designer you should be able to manage the fields and labels since the Designer is a layer that abstracts how the metadata is stored. Do you have a specific example?

Jason Green
Zurmo Team
Need support? Upgrade now


#9 k1000o

k1000o

    Advanced Member

  • Members
  • PipPipPip
  • 112 posts
  • LocationMadrid

Posted 21 February 2012 - 06:23 AM

An example would be to add a new string field called myString to the opportunities module.

1) Retrieve the model metadata
$accountModel = Account::getMetadata();

2) Use a function to add the new field
ZurmoModule::AddModelField (String, 'myString), $accountModel);
 

3) Store the model modified module
ZurmoModule::setMetadata($accountModel);
GeneralCache::forgetAll();

4) Retrieve the view metadata
$accountEditView = AccountEditAndDetailsView::getMetadata();

5) Add the field in the desired location

6) Save the modified view

#10 Jason

Jason

    Administrator

  • Administrators
  • 864 posts
  • LocationChicago

Posted 23 February 2012 - 09:54 PM

Camilo,
If you look in AttributesTest, setAndGetTextAttribute, you will see the code needed to add a custom field. I will summarize it below:
		    $attributeForm = new TextAttributeForm();
		    $attributeForm->attributeName = $attributeName;
		    $attributeForm->attributeLabels  = array(
			    'de' => 'Test Text 2 de',
			    'en' => 'Test Text 2 en',
			    'es' => 'Test Text 2 es',
			    'fr' => 'Test Text 2 fr',
			    'it' => 'Test Text 2 it',
		    );
		    $attributeForm->isAudited	 = true;
		    $attributeForm->isRequired    = true;
		    $attributeForm->maxLength	 = 50;
		    $attributeForm->defaultValue  = 'Kangaroo';
		    $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
		    $adapter = new $modelAttributesAdapterClassName(new Account());
			 $adapter->setAttributeMetadataFromForm($attributeForm);

What you will need to do though, is in your area where this is being executed, check the $opportunities->isAttribute('myNewAttribute') before you execute the creation code. This is because anytime you run resolveCustomData, this code is executed so you only want it to create the custom attribute the first time.

Regarding the view, you can modify the metadata for the views by just adding to the metadata and saving it. Please let me know if you have more questions.

Jason Green
Zurmo Team
Need support? Upgrade now


#11 sanbrar

sanbrar

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 21 August 2012 - 04:00 PM

Just wondering where can I find the Image Gallery module.

Thanks

#12 Jason

Jason

    Administrator

  • Administrators
  • 864 posts
  • LocationChicago

Posted 23 August 2012 - 02:08 AM

Just wondering where can I find the Image Gallery module.

Thanks

It is currently not public, but if you would like it please PM me.

Jason Green
Zurmo Team
Need support? Upgrade now


#13 windsor

windsor

    Advanced Member

  • Moderators
  • 272 posts
  • LocationTampa, Florida USA

Posted 06 September 2013 - 05:37 PM

Jason, your PM Is full.  Could you send the Image Gallery module to me?







Also tagged with one or more of these keywords: imageGalleries, customization

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users