You are here

function _itoggle_ajax_toggle_field in iToggle 7

Same name and namespace in other branches
  1. 7.2 itoggle.pages.inc \_itoggle_ajax_toggle_field()

Helper function Changes field values

Parameters

string $type:

string $property:

int $id:

int $value:

int $delta:

1 call to _itoggle_ajax_toggle_field()
itoggle_ajax_callback in ./itoggle.module
Page callback

File

./itoggle.module, line 106
iToggle module.

Code

function _itoggle_ajax_toggle_field($type, $property, $id, $value, $delta = 0) {

  // check permissions
  $access = FALSE;

  // @TODO check permissions
  $access = TRUE;
  if ($access) {
    $entity = current(entity_load($type, array(
      $id,
    )));
    $lang = $entity->language;
    $entity->{$property}[$lang][$delta] = $value;
    $return = entity_save($type, $entity);
    return $return !== FALSE;
  }
  return FALSE;
}