Fórum

Liferay 7 Item Selector taglib

thumbnail
Benjamin Bini, modificado 7 Anos atrás.

Liferay 7 Item Selector taglib

Junior Member Postagens: 31 Data de Entrada: 24/05/13 Postagens Recentes
I try to use Liferay 7 new Item Selector in a custom Control Panel Portlet.

I create custom entities on which I want to attach a file from Document and Media portlet.

I know that there is the "liferay-item-selector" taglibs (https://docs.liferay.com/portal/7.0/taglibs/modules/apps/collaboration/item-selector/com.liferay.item.selector.taglib/liferay-item-selector/tld-summary.html) but browsing the source in GitHub does not help me a lot to understand exactly how to make it work.

I don't see any documentation about it anywhere.

Do you have any hint ? Is a more detailed doc planned ?

Thank you very much
thumbnail
David H Nebinger, modificado 7 Anos atrás.

RE: Liferay 7 Item Selector taglib

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
Your best example for how to do something Liferay is to have the Liferay source. A search of the source yields 78 examples, one of which is https://github.com/liferay/liferay-portal/blob/master/modules/apps/collaboration/blogs/blogs-web/src/main/resources/META-INF/resources/blogs/edit_entry.jsp#L140.

Note that I didn't search github for this, I pull down the source for the version of Liferay I'm coding against and load the project into the IDE. That way I have it close by for searching.






Come meet me at the LSNA!
thumbnail
Chema Balsas, modificado 7 Anos atrás.

RE: Liferay 7 Item Selector taglib

Regular Member Postagens: 127 Data de Entrada: 25/02/13 Postagens Recentes
Hey Benjamin!

Aside from the inner modules David pointed to, you can check out this community project where they showcased how to create an item selector view for a custom entity.

Hope it helps!
thumbnail
Benjamin Bini, modificado 7 Anos atrás.

RE: Liferay 7 Item Selector taglib

Junior Member Postagens: 31 Data de Entrada: 24/05/13 Postagens Recentes
Chema Balsas:
Hey Benjamin!

Aside from the inner modules David pointed to, you can check out this community project where they showcased how to create an item selector view for a custom entity.

Hope it helps!


Thank you. But this shows how to implement a view for the item selector for a custom entity, what I try is to implement the item selector in my custom entity portlet itself, in order to be able to attach a "Document and Media" entry to this entity.

As David H Nebinger said, there are some example in the sources, I tried to immitate it, but I have issues.
For example I created a similar class to BlogsItemSelectorHelper to be able to have this "itemSelectorURL", but the injection of "ItemSelector" fails :

@Reference(
		cardinality = ReferenceCardinality.OPTIONAL,
		policy = ReferencePolicy.DYNAMIC,
		policyOption = ReferencePolicyOption.GREEDY
	)
	public void setItemSelector(ItemSelector itemSelector) {
		_itemSelector = itemSelector;
	}

	public void unsetItemSelector(ItemSelector itemSelector) {
		_itemSelector = null;
	}

	private ItemSelector _itemSelector;


ItemSelector implementation is not injected and remains null.

Besides, David H Nebinger, how do you have the source of your version of Liferay directly running in Eclipse ? I use the bundle, I have the sources attached to the jar but I don't have the sources in my workspace.

Thank you very much for taking time to answer, I appreciate it emoticon
thumbnail
Benjamin Bini, modificado 7 Anos atrás.

RE: Liferay 7 Item Selector taglib

Junior Member Postagens: 31 Data de Entrada: 24/05/13 Postagens Recentes
I allow myself to up this thread emoticon