You are here

function paragraphs_previewer_form_preview_uri in Paragraphs Previewer 7

Creates a uri for the form preview.

Parameters

array $item_parents: An array of item parents from the field to the item delta.

string $form_build_id: The form build id.

1 call to paragraphs_previewer_form_preview_uri()
paragraphs_previewer_field_widget_form_process in ./paragraphs_previewer.module
Process callback for the paragraph widget.

File

./paragraphs_previewer.module, line 57
Provides a rendered preview of a paragraphs item on an entity form..

Code

function paragraphs_previewer_form_preview_uri(array $item_parents, $form_build_id = NULL) {
  if (empty($item_parents)) {
    return array();
  }
  $options = array(
    'query' => array(
      'token' => drupal_get_token('paragraphs_previewer_form_preview'),
    ),
  );
  if (!empty($form_build_id)) {
    $options['query']['form'] = $form_build_id;
  }
  return array(
    'path' => 'paragraphs-previewer/form/' . implode('/', $item_parents),
    'options' => $options,
  );
}