Experimental project

This is a sandbox project, which contains experimental code for developer use only.

This project is based on this issue: #844944-46: Live preview of what the URL will be in the field.

From the person who wrote the patch:

Here's an approach that uses AJAX, so that it works for any token pattern without exposing the token structure to the client-side code. Whenever any form element is changed, the "live preview" is marked as needing an update, and via css, becomes grey. An AJAX request to update it is only triggered when the preview element is visible, so that if its vertical tab isn't currently open, we don't generate needless round trips to the server.

Credit for the original code goes to effulgentsia

Currently, this module creates a preview URL, which can be edited by the user. The thing that makes it a little hard to use, at the moment is the fact that URL Alias settings don't seem to be able to be moved out of the vertical tabs without some code. If you want to move the URL alias settings out of the vertical tabs, so you can have them under the title, for example, then you would need to create a custom module with the code below:

function MYMODULE_base_form_alter(&$form, &$form_state, $form_id) {
  if (isset($form['#node_edit_form']) && $form['#node_edit_form']) {
    $form['path']['#group'] = '';
    $form['path']['#title'] = '';
    $form['path']['#collapsible'] = FALSE;
    $form['path']['#collapsed'] = FALSE;
  }
}

The usual caveats about not including the ending ?> apply.

Project information

  • Created by pyrello on , updated