Commit ecbcf3cc authored by davisben's avatar davisben

Fix Weight Selector saving

parent 1f9f77ef
...@@ -52,11 +52,7 @@ class views_handler_weight_selector extends views_handler_field { ...@@ -52,11 +52,7 @@ class views_handler_weight_selector extends views_handler_field {
// At this point, the query has already been run, so we can access the results // At this point, the query has already been run, so we can access the results
foreach ($this->view->result as $row_index => $row) { foreach ($this->view->result as $row_index => $row) {
$alias = $this->table_alias; $entity = entity_load($entity_type, array($row->{$entity_key}));
$entity_id = $row->{$alias . '_entity_id'};
$entity = entity_load($entity_type, array($entity_id));
$entity = $entity[$entity_id];
$form[$this->options['id']][$row_index]['weight'] = array( $form[$this->options['id']][$row_index]['weight'] = array(
'#type' => 'select', '#type' => 'select',
...@@ -90,7 +86,7 @@ class views_handler_weight_selector extends views_handler_field { ...@@ -90,7 +86,7 @@ class views_handler_weight_selector extends views_handler_field {
$field_name = str_replace('_selector', '' , $values['views_field']); $field_name = str_replace('_selector', '' , $values['views_field']);
foreach ($values[$values['views_field']] as $value) { foreach ($values[$values['views_field']] as $value) {
$entity = $value['entity']; $entity = array_pop($value['entity']);
$lang = field_language($values['entity_type'], $entity, $field_name); $lang = field_language($values['entity_type'], $entity, $field_name);
$entity->{$field_name}[$lang][0]['value'] = $value['weight']; $entity->{$field_name}[$lang][0]['value'] = $value['weight'];
entity_save($values['entity_type'], $entity); entity_save($values['entity_type'], $entity);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment