Services Content Lock Documentation
Description
services_content_lock adds Services support to the community module called content_lock that will prevent two users from editing the same node concurrently. This module exposes the main operations of content_lock through Services as a resource, so that content locking can be done over a web service API such as REST. The main operations it currently implements are retrieve, create, and delete. This page will document how to use the operations in this resource.
Operations
The operations this resource implements for content_lock are:
- retrieve - Find out if a node is locked and get info about a lock e.g. who owns the lock and when it was created.
- create - Create a new content lock on a node. Locks a node preventing other users from editing it.
- delete - Deletes an existing lock on a node. Only the lock owner may delete the lock.
Below each operation is documented in detail, including example CURL commands.
Retrieve
Definition
Field Types and Settings
There are a defined number of field types in use, and each type has its own available settings (link is to API list_info). The settings array can appear in three places: the field definition, in instance definition, or within the instance definition's widget array.
List of field types:
Read moreCreate a quick Admin "Edit This Page" link that bypasses the content List
I sometimes do not like having to click on the Content link and then have to search for that page in the Content/Nodes screen, so this little code is handy for quickly editing a page while bypassing the Content list. Wordpress also has a quick command for this, but I never found it on Drupal.
global $user;
$role = $user->role ;
if($role=="admin" || $role=="administrator")
{
// Generate all your Drupal and PHP variables
$nid = arg(1);
$edit_this_page_link = ("<a style=" color:cyan;" href="' . $base_url . '/node/' . $nid . '/edit">Edit This Page</a>");
}This can go into any page.tpl.php or even a preprocess function in your template's template.php file.
A Programmer's Guide to Drupal
Services Client Connection
Provides extendable API for talking to remote Drupal site via services and UI for configuring connections to remote sites. Module allows to define multiple connections with different attributes to one or multiple sties. Connections can be exported either via hook or using features.
Dependencies
- ctools
- PHP cURL extension
Architecture
This module aims to create general API for connecting to remote site. To achieve that it uses ctools plugin system. Each connection consits of class with three plugins. API user shouldn't take care of any aspect of creating requests and parsing responses. Each plugin can have own configuration (similar to Feeds module).
Authentication
Ensures that requests to remote site will be authenticated. Currently there are two available methods:
- Session authentication
- OAauth (requires OAuth api module)
Server
Server plugin formats request for remote services server i.e. REST or XML-RPC. By default module comes with two plugins. Server also parses response from remote Drupal site and translate data from text form to PHP structures. Supported remote servers:
- XML-RPC server
- REST server (allow to communicate via JSON for example)
Request
Read moreServices Client
The services client module answers that age old question: how do I arbitrarily interface with the services module without having to build a new module from the ground up?
Well, the answer is finally here. Services client is designed to sit on a site and listen for events (currently node save/update and user save/update. It will then push that data up to a Drupal website running services.
It's primary use-case is to synchronize data between two Drupal sites (using UUIDs). It supports re-mapping the data as well as putting content from content type A on the client site to type B on the server site.
The module has a ways to go insofar as making it less specific to the needs it was originally created for, but it is an excellent way to get started with the services module.
