You are here

function picture_library in Picture 7.2

Same name and namespace in other branches
  1. 7 picture.module \picture_library()

Implements hook_library().

File

./picture.module, line 128
Picture formatter.

Code

function picture_library() {
  $libraries = array();
  switch (variable_get('picture_polyfill_version', 'min')) {
    case 'min':
      $libraries['picturefill_head'] = array(
        'title' => t('Picturefill head fix'),
        'version' => '3.0.1',
        'js' => array(
          'document.createElement( "picture" );' => array(
            'type' => 'inline',
            'weight' => -20,
            'group' => JS_LIBRARY,
            'scope' => 'header',
            'need_jquery' => FALSE,
          ),
        ),
      );
      $libraries['picturefill'] = array(
        'title' => t('Picturefill'),
        'website' => 'https://github.com/scottjehl/picturefill',
        'version' => '3.0.1',
        'js' => array(
          drupal_get_path('module', 'picture') . '/picturefill/picturefill.min.js' => array(
            'type' => 'file',
            'weight' => -10,
            'group' => JS_DEFAULT,
            'scope' => variable_get('picture_js_scope', 'footer'),
            'need_jquery' => FALSE,
          ),
        ),
      );
      $libraries['picture.ajax'] = array(
        'title' => t('Ajax support for picture'),
        'version' => VERSION,
        'js' => array(
          drupal_get_path('module', 'picture') . '/picture.min.js' => array(
            'type' => 'file',
            'weight' => -10,
            'group' => JS_DEFAULT,
            'scope' => variable_get('picture_js_scope', 'footer'),
            'need_jquery' => FALSE,
          ),
        ),
      );
      $libraries['lazysizes'] = array(
        'title' => t('Lazyload for picture element'),
        'version' => '1.0.1',
        'js' => array(
          drupal_get_path('module', 'picture') . '/lazysizes/lazysizes.min.js' => array(
            'type' => 'file',
            'weight' => -20,
            'group' => JS_LIBRARY,
            'need_jquery' => FALSE,
          ),
        ),
      );
      $libraries['lazysizes_aspect_ratio'] = array(
        'title' => t('Aspect ratio plugin for lazysizes'),
        'version' => '1.0.1',
        'js' => array(
          drupal_get_path('module', 'picture') . '/lazysizes/plugins/aspectratio/ls.aspectratio.min.js' => array(
            'type' => 'file',
            'weight' => -10,
            'group' => JS_LIBRARY,
            'need_jquery' => FALSE,
          ),
        ),
        'css' => array(
          drupal_get_path('module', 'picture') . '/lazysizes/plugins/aspectratio/ls.aspectratio.css' => array(
            'type' => 'file',
            'media' => 'screen',
          ),
        ),
      );
      break;
    case 'dev':
      $libraries['picturefill_head'] = array(
        'title' => t('Picturefill head fix'),
        'version' => '3.0.1',
        'js' => array(
          'document.createElement( "picture" );' => array(
            'type' => 'inline',
            'weight' => -10,
            'group' => JS_DEFAULT,
            'scope' => 'header',
            'need_jquery' => FALSE,
          ),
        ),
      );
      $libraries['picturefill'] = array(
        'title' => t('Picturefill'),
        'website' => 'https://github.com/scottjehl/picturefill',
        'version' => '3.0.1',
        'js' => array(
          drupal_get_path('module', 'picture') . '/picturefill/picturefill.js' => array(
            'type' => 'file',
            'weight' => -10,
            'group' => JS_DEFAULT,
            'scope' => variable_get('picture_js_scope', 'footer'),
            'need_jquery' => FALSE,
          ),
        ),
      );
      $libraries['picture.ajax'] = array(
        'title' => t('Ajax support for picture'),
        'version' => VERSION,
        'js' => array(
          drupal_get_path('module', 'picture') . '/picture.js' => array(
            'type' => 'file',
            'weight' => -10,
            'group' => JS_DEFAULT,
            'scope' => variable_get('picture_js_scope', 'footer'),
            'need_jquery' => FALSE,
          ),
        ),
      );
      $libraries['lazysizes'] = array(
        'title' => t('Lazyload for picture element'),
        'version' => '1.0.1',
        'js' => array(
          drupal_get_path('module', 'picture') . '/lazysizes/lazysizes.js' => array(
            'type' => 'file',
            // file has async, put before all files to prevent JS concatenation breaking
            'weight' => -20,
            'group' => JS_LIBRARY,
            'need_jquery' => FALSE,
          ),
        ),
      );
      $libraries['lazysizes_aspect_ratio'] = array(
        'title' => t('Aspect ratio plugin for lazysizes'),
        'version' => '1.0.1',
        'js' => array(
          drupal_get_path('module', 'picture') . '/lazysizes/plugins/aspectratio/ls.aspectratio.js' => array(
            'type' => 'file',
            'weight' => -10,
            'group' => JS_LIBRARY,
            'need_jquery' => FALSE,
          ),
        ),
        'css' => array(
          drupal_get_path('module', 'picture') . '/lazysizes/plugins/aspectratio/ls.aspectratio.css' => array(
            'type' => 'file',
            'media' => 'screen',
          ),
        ),
      );
      break;
  }
  return $libraries;
}