You are here

function _noderelationships_views_ui_form_alter in Node Relationships 6

Alter views ui related forms.

See also

noderelationships_form_alter()

1 call to _noderelationships_views_ui_form_alter()
noderelationships_form_alter in ./noderelationships.module
Implementation of hook_form_alter().

File

./noderelationships.admin.inc, line 938
Implementation of the administration pages of the module.

Code

function _noderelationships_views_ui_form_alter(&$form, $form_state, $form_id, $view_tag) {

  // Make sure the path in page displays is not changed.
  // It should be unique and private for this module.
  if ($form_id == 'views_ui_edit_display_form') {
    if (isset($form_state['section']) && $form_state['section'] == 'path' && isset($form['path'])) {
      _noderelationships_views_ui_form_element_disable($form['path'], array(
        'value' => NODERELATIONSHIPS_VIEW_PATH_PREFIX . '/' . str_replace('_', '-', $form_state['view']->name) . '/' . str_replace('_', '-', $form_state['display_id']),
        'description' => t('The path assigned to this view is dynamically customized by the Node Relationships module.'),
      ));
    }
    return;
  }

  // Make sure the view tag is not changed on view settings and clone view forms.
  if ($form_id == 'views_ui_edit_details_form' || $form_id == 'views_ui_add_form') {
    if (isset($form['tag'])) {
      _noderelationships_views_ui_form_element_disable($form['tag'], array(
        'value' => $form_id == 'views_ui_edit_details_form' ? $form_state['view']->tag : $form['tag']['#default_value'],
        'description' => t('The tag assigned to this view is marked readonly because it is used to trigger the dynamic customizations of the view performed by the Node Relationships module.'),
      ));
    }
    return;
  }
}