0

I have content type field called 'field_p_bo' and it have the computed code as follows enter image description here

it causes some problem since it affect the saving of this content type , This code is there for some other fields too . What will happen when i remove the computed code ? will it affect any other part of the content type ?

4
  • It's not possible to say without knowing all of the attributes of the content type. Try it on your dev copy and test. That's the only way you'll know for sure
    – Clive
    Commented Jan 7, 2016 at 13:42
  • didnt understand Try it on your dev copy and test am already on my dev system
    – KTM
    Commented Jan 7, 2016 at 13:52
  • I need answer for what the computed code does for the content type
    – KTM
    Commented Jan 7, 2016 at 13:53
  • It saves the node if it isn't already saved, gets some data from the database, and populates the field with it. If you want context you'll need to ask the person who wrote the code what it's intended to do. It's not something that can be guessed. Same thing for will it affect any other part of the content type ? Only you or someone else with access to the full site/code can answer thta
    – Clive
    Commented Jan 7, 2016 at 14:00

1 Answer 1

0

The code fetches the id of the node_project.

For example if the node's project field is set 'Foo' it will get the id of that row where it was saved. As its not clear from where $node comes whether its current loaded node or any other node. But it seems that in computed field you are storing the ID of the project

What I think is causing the problem is if project names are FOO and FOO_BAR the query will result both the ids which can cause to store incorrect ids.

You can simply remove the like operator and add equality.

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.