Mark node for indexing manually

day to day activity

When an associated node gets changed, the original node doesn’t reflect the changes on solr. In this case the node which contains such information on solr should be pushed/marked for indexing. It is considered that search_api is being used. The current example will work when node gets pushed immediate to solr when changes are made.

Right now is taken to show the example.
Here the site has Club group which is a node. This group is used in projects. So whenever s project is created, the Group on solr should show the total number of projects. Also when a donation is made to a project, the corresponding club/group gets sum to donation made to this.

In this case, whenever such case occurs, we only need to make an entry in search_api_item.

mysql> desc search_api_item;
| Field | Type | Null | Key | Default | Extra |

View original post 137 more words


How to make a form element required with states ?

So the problem is when you try to make a field required using ‘states’ , it is not getting validated because everything happens in the browser (client side), nothing get validated on server side. So if you try this code.

'required' => array(
':input[name="save_settings"]' => array('checked' => TRUE),

This will add the red asterisk to the form element but it will not get validated. So the solution is

You need to add custom validation in hook_form_validate function.

Reference :