I want to use the computed field in my drupal 8 website to calculate the charges for a parking system where I calculate the charge for a vehicle by taking the date of collection minus the date of parking, multiplying by the charge per day. total-charges=(collection-paking)*charge-per-day. However, even before I do the calculation, I tested to see if the computed field is working by assigning the
$value='hello' and the assign the
$disply_output=$value but its not being displayed in the content of the node together with other fields. Other things done to try to resolve this issue
- Change the data type from varchar to text to int and others
- Change the settings in the 'manage display' option of the content type. From toggling sanitize on an off, change display of the computed field from above to inline, etc
- Resave the node by clicking edit and then saving the node, and even creating a new node of that content type after adding the content field.
Still not working.
After googling, most common solution, which works for drupal 7 guys is to uncheck the option to save the field in the database. But I dont see that option in drupal 8 so that I can uncheck it. Because I do not want to store the value in the database since It changes everyday a vehicle is not collected, so all I want is to calculate the value on the fly and charge the vehicle owner when collecting the vehicle. How do I make the computed field even display a simple 'Hello World'?