You are here

public function DataProviderPlug::update in RESTful 7.2

Update operation.

Parameters

mixed $identifier: The ID of thing to be updated.

mixed $object: The thing that will be set.

bool $replace: TRUE if the contents of $object will replace $identifier entirely. FALSE if only what is set in $object will replace those properties in $identifier.

Return value

array An array of structured data for the thing that was updated.

Overrides CrudInterface::update

File

src/Plugin/resource/DataProvider/DataProviderPlug.php, line 105
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderPlug.

Class

DataProviderPlug
Class DataProviderPlug.

Namespace

Drupal\restful\Plugin\resource\DataProvider

Code

public function update($identifier, $object, $replace = FALSE) {

  // TODO: Document how to enable/disable resources using the API.
  $disabled_plugins = variable_get('restful_disabled_plugins', array());
  if ($object['enable']) {
    $disabled_plugins[$identifier] = FALSE;
  }
  variable_set('restful_disabled_plugins', $disabled_plugins);
}