Plone and dexterity custom index - plone

I've created a custom folderish content type (bobo) using dexterity and a custom index (ibobo) in the catalog.
I'm able to put images inside bobo with no problem.
The problem is the images are being indexed in ibobo and I don't want this.
The ibobo index is working well when I change bobo data but the images keep the old data in its ibobo index.
It is crazy because images don't have ibobo index.
How can I avoid images indexing in this case?
Thank you.

If I understood correctly, you want use a dedicated index for you content type and avoid indexing anything else into your index.
You can achieve this by
Create a custom indexer using plone.indexerfor you content type interface.
Create an another indexer using plone.indexer for zope.interface.Interface that only to raises AttributeError.
That should stop the default indexing and only your dedicated content type gets indexed into your index.
The issue is, that for historical reasons Plone (Zope2/ZCatalog) indexes try to index everything, which either has an attribute with the name of the index (or its configured indexable attribute) or can acquire a such attribute using acquisition.

Related

Use the unique values from a field in one content type as a filter in another content type

I need some help with a Drupal views filter. I'm not a developer but I have been using Drupal for several years.
I have a content type named 'City/Town' that contains several fields including state and county. I'm using this content type as an entity reference field in another content type named 'Project'.
I would like to use a unique value list of States as a filter in a view of Projects.
I've installed the Views Entity Reference Filter (https://www.drupal.org/project/verf) module but I'm only able to access the entity reference title, not any of the fields that are part of the content type.
The project I'm working on is still in design phase so I can change my approach if there is a viable solution.
You need to get the relationship to the reference in views. Then you have access to the fields of the reference for viewing, sorting & filtering.

What is the syntax to add a column to the Custom Form list that shows where in WF it is used?

Super simple.
When viewing the list of Custom Forms in Setup, I want to add a column that shows where those Custom Forms are in use (or null if used nowhere).
This is similar in principle to viewing the list of fields, which has a list of forms on which those fields are used.
What is the syntax I can use to add the appropriate column(s) to the view?
As far as I know, there is no linkage in the backend that connects categories (custom forms) to their host objects. This is probably because the list could be massive and the query would take quite a while to execute as it would have to traverse every object in Workfront or each form would store every parent object ID.
Unfortunately, you can't even search for objects by associated category IDs, so if you wanted to build this yourself you would need to query each object and search its categories to see if your custom form appeared.

How do I get the location field to show anything in plone-4.x collections

I am trying to use a collection that will list items by state and provide a link to them in the location field of a table listing. The reason the location is important is that the same item can be added to lots of different folders/objects, so the title and type is not informative enough. Anyway, my problem is that the location gives a blank entry in the table displaying the collection. I have tried this for all types of items on my site: pages, folders, custom dexterity content types, etc.. Any hints?
Present configuration is Plone-4.3
Thanks.
The "location" field you are using is probably the ones only populated by the Event content type (please, check it).
If I'm not wrong, you can:
add a new index to the catalog that index the getLocation attribute, that will load the "Location" metadata; then add a new collection configuration for loading this new metadata
add a new indexer that will load the getLocation information using the same "location"
The 1 is the easy way (probably you can do all TTW) but way 2 is cleaner (but require some development)

getting all ImageFields associated with a node

How do i get all the image fields attached to a content type on a full node without knowing the field names? Just out of curiosity, is there a way we can get all the fields of a specific type?
I am developing a module that needs image fields tied to a specific node and i'm using hook_node_view for fetching the node data.
I already viewed following post and it seems pretty relevant but i had difficulty understanding.
How to get the first image field from a node without knowing the field's name?
This can be done by checking all the fields of your content type & check its "type" field
if the type field is a image you can render it
Well, i finally found the function i was looking for and it was pretty simple. All i had to do was to get all the fields field_info_instances() with $entity_type as the first parameter and then iterating over the result to get the widget type 'image_image' for ImageFields.

umbraco and custom system table

I have the following scenario:
My website db has a system table called "Companies", which includes an id field, companyName field, and companyImageUrl field.
How do I set up an umbraco document type for adding entries to this table ?
Maybe I shouldn't use a custom table at all ?
Thanks.
As far as I know, Umbraco doesn't support what you want to do out of the box (mapping a document type to a table that isn't part of the umbraco core).
One approach that might work is to create an action handler that syncs a Company doc type to your table when creating a node of that type.
It's a bit of a hack though. I've found that I've very rarely needed to create custom tables. What exactly are you trying to do with it? My guess is that you don't really need it and would be better off working with a doc type instead. Umbraco provides a variety of ways to get and act upon doc types from within custom C# code (check out the umbraco.NodeFactory namespace). You'll also get the added benefit of being able to easily interact with these nodes from XSLT/Razor.

Resources