Assign a calculated PHP value to the field.
In general, I need to get the value of one field into another. When I tried to do this on a "test" content type using the Computed field, it works, but when I tried to transfer it to another content type, it throws an error.
Specifically: I need to get the website address from the field field_link and calculate the TCI, PR, presence in Yandex Catalog, and DMOZ.
Here is the error that it gives:
PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1: INSERT INTO {field_data_field_link} (entity_type, entity_id, revision_id, bundle, delta, language, field_link_url, field_link_title, field_link_attributes) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8_rel, :db_insert_placeholder_8_class); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 120 [:db_insert_placeholder_2] => 120 [:db_insert_placeholder_3] => ad [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => http://userwebsite.ru [:db_insert_placeholder_7] => Go to resource [:db_insert_placeholder_8_rel] => nofollow [:db_insert_placeholder_8_class] => art-button but ) in function field_sql_storage_field_storage_write() (line 448 in file /home/p/pratru/swap-ad/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module.
I don't know how to solve this.. apparently there's some kind of conflict 0_0
I want to try this:
Assigning the value obtained from PHP code as "default". How can I implement this? It seems like through hooks.. But I'm not very familiar with hooks
+ I somehow need to get the value of the field field_link..
This is how I get the value of field_link:
<?php $node=menu_get_object();
if(isset($node->field_link)) {
$b = render(field_view_field('node', $node, 'field_link'));
$entity_field[0]['value'] = $b; //having obtained the website address from that field, the TCI, PR and etc are determined ?>
Please help. I want to implement a very important function..