diff --git a/deploy_services_client.client.inc b/deploy_services_client.client.inc index 00ca01f..6681007 100644 --- a/deploy_services_client.client.inc +++ b/deploy_services_client.client.inc @@ -225,17 +225,29 @@ class DeployServicesClient { $entity_to_send = reset($entities_to_send); // Bail out if we don't have a status property. - if (!isset($entity_to_send->status)) { + if (!isset($entity_to_send->status) && $entity->type() != 'menu_link') { throw new DeployServiceException(t('Entity of type "@type" with UUID "@uuid" did not have a "status" property and could not be unpublished.', array( '@type' => $entity->type(), '@uuid' => $entity->uuid->value(), ))); } + else if (!isset($entity_to_send->hidden) && $entity->type() == 'menu_link') { + throw new DeployServiceException(t('Entity of type "@type" with UUID "@uuid" did not have a "hidden" property and could not be unpublished.', array( + '@type' => $entity->type(), + '@uuid' => $entity->uuid->value(), + ))); + } - // Set the status to unpublished and send the request. + // Set the status to unpublished / hidden (menu_link) and send the request. // @todo: We'd like to return something here to indicate success or // failure, but it's not clear what to return. - $entity_to_send->status = 0; + if ($entity->type() == 'menu_link') { + $entity_to_send->hidden = 1; + } + else { + $entity_to_send->status = 0; + } + $json_data = drupal_json_encode($entity_to_send); $this->entityRequest($entity, 'PUT', $json_data); } diff --git a/deploy_services_client.module b/deploy_services_client.module index 2faf8a6..58b3469 100644 --- a/deploy_services_client.module +++ b/deploy_services_client.module @@ -113,6 +113,10 @@ function deploy_services_client_unpublish_entity_from_endpoint(EntityMetadataWra // @todo: If the unpublish method can be changed to have a return value, we // should return that, rather than assuming the entity was always // unpublished successfully. + $client->unpublish($entity); + $success = TRUE; + } + else if (($entity_data = $client->get($entity)) && !empty($entity_data['hidden']) && $entity->type() == 'menu_link') { $client->unpublish($entity); $success = TRUE; }