You are here

clientside_validation_testswarm.install in Clientside Validation 7

Install functions for Clientside Validation Testswarm.

File

clientside_validation_testswarm/clientside_validation_testswarm.install
View source
<?php

/**
 * @file
 * Install functions for Clientside Validation Testswarm.
 */

/**
 * Implements hook_uninstall().
 */
function clientside_validation_testswarm_uninstall() {
  variable_del('clientside_validation_rules_added');
  variable_del('clientside_validation_testswarm_nodenames');
}

/**
 * Import the webform needed to test Clientside Validation Webform.
 */
function clientside_validation_testswarm_update_7101() {
  $nodenames = variable_get('clientside_validation_testswarm_nodenames', array());
  if (empty($nodenames)) {
    clientside_validation_testswarm_enable();
  }
}

/**
 * Add the path alias and menu link for the default node.
 */
function clientside_validation_testswarm_update_7102() {
  if (module_exists('path')) {
    foreach (variable_get('clientside_validation_testswarm_nodenames', array()) as $machine_name => $nid) {
      $node = node_load($nid);
      $path = array(
        'source' => 'node/' . $nid,
        'alias' => 'clientsidevalidation/tests/' . $machine_name,
      );
      if (isset($node->language)) {
        $path['language'] = $node->language;
      }
      path_save($path);
    }
  }
  $link = array(
    'menu_name' => 'navigation',
    'link_path' => 'node-name/webform',
    'router_path' => 'node/%',
    'link_title' => 'Clientside Validation Webform Tests',
    'options' => array(
      'attributes' => array(
        'title' => 'Test Clientside Validation on form elements provided by the Webform module',
      ),
    ),
    'module' => 'menu',
    'hidden' => '0',
    'external' => '0',
    'has_children' => '0',
    'expanded' => '0',
    'weight' => '0',
    'parent_path' => 'clientsidevalidation/tests',
    'identifier' => 'navigation:node-name/webform',
    'pid' => db_select('menu_links', 'ml')
      ->fields('ml')
      ->condition('link_path', 'clientsidevalidation/tests')
      ->execute()
      ->fetchObject()->mlid,
  );
  defaultcontent_import_menu_link($link['identifier'], $link);
}

/**
 * Add the content type to test Clientside Validation Field Validation.
 */
function clientside_validation_testswarm_update_7103() {
  if (!module_exists('clientside_validation_test_field_validation')) {
    module_enable(array(
      'clientside_validation_test_field_validation',
    ));
  }
  $link = array(
    'menu_name' => 'navigation',
    'link_path' => 'node/add/cv-test-field-validation',
    'router_path' => 'node/add/cv-test-field-validation',
    'link_title' => 'Clientside Validation Test Field Validation',
    'options' => array(
      'attributes' => array(
        'title' => 'Test Clientside Validation Field Validation',
      ),
    ),
    'module' => 'menu',
    'hidden' => '0',
    'external' => '0',
    'has_children' => '0',
    'expanded' => '0',
    'weight' => '0',
    'parent_path' => 'clientsidevalidation/tests',
    'pid' => db_select('menu_links', 'ml')
      ->fields('ml')
      ->condition('link_path', 'clientsidevalidation/tests')
      ->execute()
      ->fetchObject()->mlid,
    'identifier' => 'navigation:node/add/cv-test-field-validation',
  );
  defaultcontent_import_menu_link($link['identifier'], $link);
}

/**
 * Import the webform needed to test Clientside Validation Webform Validation.
 */
function clientside_validation_testswarm_update_7104() {
  clientside_validation_testswarm_enable();
}

Functions

Namesort descending Description
clientside_validation_testswarm_uninstall Implements hook_uninstall().
clientside_validation_testswarm_update_7101 Import the webform needed to test Clientside Validation Webform.
clientside_validation_testswarm_update_7102 Add the path alias and menu link for the default node.
clientside_validation_testswarm_update_7103 Add the content type to test Clientside Validation Field Validation.
clientside_validation_testswarm_update_7104 Import the webform needed to test Clientside Validation Webform Validation.