You are here

function fieldable_panels_panes_services_create in Fieldable Panels Panes (FPP) 7

Adds a new Fieldable Panels Pane and return the fpid.

Parameters

array $fpp: The data to create the fieldable panels pane with.

Return value

int|mixed Returns the ID of the Fieldable Panels Pane or errors.

1 string reference to 'fieldable_panels_panes_services_create'
fieldable_panels_panes_services_resources in ./fieldable_panels_panes.services.inc
Implements hook_services_resources().

File

./fieldable_panels_panes.services.inc, line 240
Contains callbacks for service resource manipulation.

Code

function fieldable_panels_panes_services_create(array $fpp) {
  $fpp_new = fieldable_panels_panes_create($fpp);
  $form_state = array();
  $form_state['values'] = $fpp;
  $form_state['entity'] = $fpp_new;
  drupal_form_submit('fieldable_panels_panes_entity_edit_form', $form_state);
  if ($errors = form_get_errors()) {
    return services_error(implode(" ", $errors), 406, array(
      'form_errors' => $errors,
    ));
  }
  $fpp = $form_state['entity'];
  return array(
    'fpid' => $fpp->fpid,
    'uri' => services_resource_uri(array(
      'fieldable_panels_pane',
      $fpp->fpid,
    )),
  );
}