You are here

function restful_angular_example_library in RESTful 7

Implements hook_library().

File

modules/restful_angular_example/restful_angular_example.module, line 89
Example module for the RESTful AngularJs module.

Code

function restful_angular_example_library() {
  $bower_path = drupal_get_path('module', 'restful_angular_example') . '/components/restful-app/bower_components';

  // AngularJS library.
  $libraries['angular'] = array(
    'title' => t('AngularJS'),
    'version' => '1.2.27',
    'website' => 'https://github.com/angular/angular.js',
    'js' => array(
      $bower_path . '/angular/angular.js' => array(),
    ),
  );

  // JSON pretty print library.
  $libraries['json-pretty-print'] = array(
    'title' => t('JSON pretty print'),
    'version' => '0.1.1',
    'website' => 'https://github.com/darul75/ng-prettyjson',
    'js' => array(
      $bower_path . '/ng-prettyjson/dist/ng-prettyjson.min.js' => array(),
    ),
    'css' => array(
      $bower_path . '/ng-prettyjson/dist/ng-prettyjson.min.css' => array(),
    ),
    'dependencies' => array(
      array(
        'restful_angular_example',
        'angular',
      ),
    ),
  );

  // Select2 library.
  $libraries['select2'] = array(
    'title' => t('Select 2'),
    'version' => '0.0.5',
    'website' => 'https://github.com/angular-ui/ui-select',
    'js' => array(
      $bower_path . '/ui-select/dist/select.min.js' => array(),
    ),
    'css' => array(
      $bower_path . '/ui-select/dist/select.min.css' => array(),
    ),
    'dependencies' => array(
      array(
        'restful_angular_example',
        'angular',
      ),
    ),
  );

  // File upload library.
  $libraries['file-upload'] = array(
    'title' => t('File upload'),
    'version' => '2.0.0',
    'website' => 'https://github.com/danialfarid/angular-file-upload',
    'js' => array(
      $bower_path . '/danialfarid-angular-file-upload/dist/angular-file-upload-shim.min.js' => array(),
      $bower_path . '/danialfarid-angular-file-upload/dist/angular-file-upload.min.js' => array(),
    ),
    'dependencies' => array(
      array(
        'restful_angular_example',
        'angular',
      ),
    ),
  );

  // ng-admin library.
  $libraries['ng-admin'] = array(
    'title' => t('ng-admin'),
    'version' => '0.3.3',
    'website' => 'https://github.com/marmelab/ng-admin',
    'js' => array(
      $bower_path . '/ng-admin/build/ng-admin.min.js' => array(),
    ),
    'css' => array(
      $bower_path . '/ng-admin/build/ng-admin.min.css' => array(),
    ),
    'dependencies' => array(
      array(
        'restful_angular_example',
        'angular',
      ),
    ),
  );

  // Load our custom app.
  $app_path = drupal_get_path('module', 'restful_angular_example') . '/components/restful-app/dist';

  // Custom libraries.
  $libraries['restful-angular-form'] = array(
    'title' => t('RESTful Angular Form'),
    'version' => '1.0.0',
    'website' => 'https://github.com/Gizra/restful/blob/7.x-1.x/modules/restful_angular_example/README.md',
    'js' => array(
      $app_path . '/restful-app.js' => array(),
    ),
    'css' => array(
      $app_path . '/css/restful-app.css' => array(),
    ),
    'dependencies' => array(
      array(
        'restful_angular_example',
        'json-pretty-print',
      ),
      array(
        'restful_angular_example',
        'select2',
      ),
      array(
        'restful_angular_example',
        'file-upload',
      ),
    ),
  );
  $libraries['restful-angular-admin'] = array(
    'title' => t('RESTful Angular Admin'),
    'version' => '1.0.0',
    'website' => 'https://github.com/Gizra/restful/blob/7.x-1.x/modules/restful_angular_example/README.md',
    'js' => array(
      $app_path . '/restful-app.js' => array(),
    ),
    'css' => array(
      $app_path . '/css/restful-app.css' => array(),
    ),
    'dependencies' => array(
      array(
        'restful_angular_example',
        'ng-admin',
      ),
    ),
  );
  return $libraries;
}