0

I have a Job content type (created only by a Client), with an Entity Reference field, "candidates".

Freelancers (user role) see a Views block of jobs created.

How do I add an "Express interest" button to each job so that the freelancer who clicks it gets referenced by the job?

1 Answer 1

1

You can create a custom module dealing with the subscriptions. Implement hook_menu(), and create a callback url that gets the NID (I suppose your content type is derived from the node entity, but it would work for custom entities as well) as parameter, e.g. 'node/%node/subscribe'.

Within the callback function you check whether the current user has already subscribed for this job and create the reference programmatically if not.

In your view make sure to read the NID property. You may hide it from display. Then you can easily add another field, and rewrite its output as link using the [nid] token from the previously hidden NID, in the above example, the URI would be 'node/[nid]/subscribe'.

Last not least you can CSS style your link to look like a button.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.