Skip to content
Snippets Groups Projects
Commit 038575ab authored by Chris Gross's avatar Chris Gross
Browse files

daily build

parent 7e30c116
No related branches found
No related tags found
No related merge requests found
Showing
with 682 additions and 1 deletion
WCM Base 7.x-1.x, 2015-07-14
----------------------------
- Media Magnet: added OpenOSU module to allow adding Media Magnet feeds.
- OCIO Panels Settings: Media Magnet modifications.
WCM Base 7.x-1.x, 2015-07-13 WCM Base 7.x-1.x, 2015-07-13
---------------------------- ----------------------------
- Media: updated to 7.x-2.0-alpha4 - Media: updated to 7.x-2.0-alpha4
...@@ -17,7 +22,6 @@ WCM Base 7.x-1.x, 2015-07-07 ...@@ -17,7 +22,6 @@ WCM Base 7.x-1.x, 2015-07-07
- OCIO Omega Base: Fixed image overflow, image captions and missing mobile menu icon. - OCIO Omega Base: Fixed image overflow, image captions and missing mobile menu icon.
- OCIO Omega Base: Added 3x3 tile grid to 'ocio-omega-tiles-equalcol' panels layout. - OCIO Omega Base: Added 3x3 tile grid to 'ocio-omega-tiles-equalcol' panels layout.
WCM Base 7.x-1.x, 2015-07-06 WCM Base 7.x-1.x, 2015-07-06
---------------------------- ----------------------------
- Created changelog. - Created changelog.
......
# OSX hidden files
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.Spotlight-V100
.Trashes
# Windows hidden files
Thumbs.db
ehthumbs.db
$RECYCLE.BIN/
Media Magnet
============
This is a collection of Drupal modules providing integration with Media Magenet
Vocabularies (mm_vocab)
-----------------------
* Creates one vocabulary per media magnet group.
* Dynamically syncs vocabularies at installation and cron.
* Adds hooks to create vocabularies based on things like directories.
* Creates a single MM base field.
### Installation
1. Download the `entityreference`, `features`, `mm_vocab`, `mm_vocab_field`, `mm_example` modules
2. Enable `mm_vocab`
3. Enable the `mm_vocab_field` and `mm_example` features
4. Add the newly created `field_media_magnet_keywords` field to any of your content types you wish to add the field to
Widgets (mm_widgets)
--------------------
* Allows for creation of one or more blocks pulling in Media Magnet content.
* Supports [Multiblock](https://www.drupal.org/project/multiblock).
* Supports [Panels](https://www.drupal.org/project/panels)
* Block-level configuration of template to render item.
* All content is loaded and rendered client side via Javascript -- no need to cache content items.
<?php
/**
* @file
* mm_example.features.field_base.inc
*/
/**
* Implements hook_field_default_field_bases().
*/
function mm_example_field_default_field_bases() {
$field_bases = array();
// Exported field_base: 'field_media_magnet_keywords'
$field_bases['field_media_magnet_keywords'] = array(
'active' => 1,
'cardinality' => -1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_media_magnet_keywords',
'indexes' => array(
'target_id' => array(
0 => 'target_id',
),
),
'locked' => 0,
'module' => 'entityreference',
'settings' => array(
'handler' => 'views',
'handler_settings' => array(
'behaviors' => array(
'views-select-list' => array(
'status' => 1,
),
),
'view' => array(
'args' => array(),
'display_name' => 'entityreference_1',
'view_name' => 'media_magnet_filter',
),
),
'target_type' => 'taxonomy_term',
),
'translatable' => 0,
'type' => 'entityreference',
);
return $field_bases;
}
<?php
/**
* @file
* mm_example.features.field_instance.inc
*/
/**
* Implements hook_field_default_field_instances().
*/
function mm_example_field_default_field_instances() {
$field_instances = array();
// Exported field_instance: 'node-media_magnet_example-body'
$field_instances['node-media_magnet_example-body'] = array(
'bundle' => 'media_magnet_example',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 0,
),
'teaser' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(
'trim_length' => 600,
),
'type' => 'text_summary_or_trimmed',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'body',
'label' => 'Body',
'required' => FALSE,
'settings' => array(
'display_summary' => TRUE,
'text_processing' => 1,
'user_register_form' => FALSE,
),
'widget' => array(
'module' => 'text',
'settings' => array(
'rows' => 20,
'summary_rows' => 5,
),
'type' => 'text_textarea_with_summary',
'weight' => 31,
),
);
// Exported field_instance:
// 'node-media_magnet_example-field_media_magnet_keywords'
$field_instances['node-media_magnet_example-field_media_magnet_keywords'] = array(
'bundle' => 'media_magnet_example',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'entityreference',
'settings' => array(
'link' => FALSE,
),
'type' => 'entityreference_label',
'weight' => 1,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_media_magnet_keywords',
'label' => 'Media Magnet Keywords',
'required' => 0,
'settings' => array(
'behaviors' => array(
'taxonomy-index' => array(
'status' => TRUE,
),
),
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(
'apply_chosen' => '',
),
'type' => 'options_select',
'weight' => 33,
),
);
// Translatables
// Included for use with string extractors like potx.
t('Body');
t('Media Magnet Keywords');
return $field_instances;
}
<?php
/**
* @file
* mm_example.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function mm_example_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}
/**
* Implements hook_node_info().
*/
function mm_example_node_info() {
$items = array(
'media_magnet_example' => array(
'name' => t('Media Magnet Example'),
'base' => 'node_content',
'description' => t('Example content type '),
'has_title' => '1',
'title_label' => t('Title'),
'help' => '',
),
);
drupal_alter('node_info', $items);
return $items;
}
name = Media Magnet Example
description = Example feature for getting the Media Magnet Vocab module fully set up.
core = 7.x
package = Media Magnet
version = 7.x-1.0
dependencies[] = entityreference
dependencies[] = features
dependencies[] = mm_vocab
dependencies[] = options
dependencies[] = text
features[ctools][] = strongarm:strongarm:1
features[features_api][] = api:2
features_exclude[field_base][] = field_media_magnet_keywords
features[field_instance][] = node-media_magnet_example-body
features[field_instance][] = node-media_magnet_example-field_media_magnet_keywords
features[node][] = media_magnet_example
features[variable][] = field_bundle_settings_node__media_magnet_example
features[variable][] = language_content_type_media_magnet_example
features[variable][] = menu_options_media_magnet_example
features[variable][] = menu_parent_media_magnet_example
features[variable][] = node_options_media_magnet_example
features[variable][] = node_preview_media_magnet_example
features[variable][] = node_submitted_media_magnet_example
features_exclude[field_base][] = field_media_magnet_keywords
features_exclude[dependencies][strongarm] = strongarm
<?php
/**
* @file
* Code for the Media Magnet Example feature.
*/
include_once 'mm_example.features.inc';
<?php
/**
* @file
* mm_example.strongarm.inc
*/
/**
* Implements hook_strongarm().
*/
function mm_example_strongarm() {
$export = array();
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'field_bundle_settings_node__media_magnet_example';
$strongarm->value = array(
'view_modes' => array(),
'extra_fields' => array(
'form' => array(
'title' => array(
'weight' => '-5',
),
'path' => array(
'weight' => '30',
),
),
'display' => array(),
),
);
$export['field_bundle_settings_node__media_magnet_example'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'language_content_type_media_magnet_example';
$strongarm->value = '0';
$export['language_content_type_media_magnet_example'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'menu_options_media_magnet_example';
$strongarm->value = array(
0 => 'main-menu',
);
$export['menu_options_media_magnet_example'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'menu_parent_media_magnet_example';
$strongarm->value = 'main-menu:0';
$export['menu_parent_media_magnet_example'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'node_options_media_magnet_example';
$strongarm->value = array(
0 => 'status',
1 => 'promote',
);
$export['node_options_media_magnet_example'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'node_preview_media_magnet_example';
$strongarm->value = '1';
$export['node_preview_media_magnet_example'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'node_submitted_media_magnet_example';
$strongarm->value = 1;
$export['node_submitted_media_magnet_example'] = $strongarm;
return $export;
}
<?php
class MmVocabSyncService {
/**
* Fetches an associative array of categories and keywords.
*
* @return array
* An associative array of categories and keywords.
*/
public static function fetch() {
$categories = array();
$page = 0;
$last = 1;
while ($page < $last) {
$page++;
$path = "https://mediamagnet.osu.edu/api/v1/keywords.json?page=$page";
$request = drupal_http_request($path);
$result = json_decode($request->data);
$last = $result->meta->total_pages;
foreach ($result->keywords as $keyword) {
$categories[$keyword->category][] = $keyword;
}
}
return $categories;
}
/**
* Create and synchronize vocabularies.
*/
public static function sync() {
$categories = MmVocabSyncService::fetch();
foreach ($categories as $category => $keywords) {
// Create the vocabulary if it doesn't exist.
$machine_name = 'mm_' . $category;
$plural = ucfirst($category) . 's';
$vocab = taxonomy_vocabulary_machine_name_load($machine_name);
if (!$vocab) {
$vocab = new stdClass();
MmVocabSyncService::addDisplayName($machine_name);
}
// Update and save vocabulary.
$vocab->name = $plural . ' (Media Magnet)';
$vocab->machine_name = $machine_name;
$vocab->description = $plural . ' keywords from Media Magnet';
$vocab->hierarchy = 0;
$vocab->module = 'mm';
$vocab->weight = 0;
taxonomy_vocabulary_save($vocab);
// Create each term if it doesn't exist.
foreach ($keywords as $keyword) {
$term = taxonomy_get_term_by_name($keyword->name, $machine_name);
if (!$term) {
$term = new stdClass();
$term->name = $keyword->name;
$term->field_mm_display_name[LANGUAGE_NONE][0]['value'] = $keyword->display_name;
$term->description = $keyword->description;
$term->vid = $vocab->vid;
taxonomy_term_save($term);
}
}
}
}
/**
* @param $machine_name
* Machine name of the target vocabulary.
*/
private static function addDisplayName($machine_name) {
$field_name = 'field_mm_display_name';
if (!field_info_field($field_name)) {
$field = array(
'field_name' => $field_name,
'type' => 'text',
'label' => t('Display name'));
field_create_field($field);
}
// Attach the field to our taxonomy entity
$instance = array(
'field_name' => 'field_mm_display_name',
'entity_type' => 'taxonomy_term',
'bundle' => $machine_name,
'label' => t('Display name'),
'description' => t('Human readable name'),
'required' => true,
'widget' => array(
'type' => 'text_textfield',
'settings'=> array(
'max_width'=>60,
)
),
);
field_create_instance($instance);
}
public static function uninstall() {
$vocabs = taxonomy_get_vocabularies();
foreach ($vocabs as $vid => $vocab) {
if ($vocab->module == 'mm') {
taxonomy_vocabulary_delete($vid);
}
}
}
}
<?php
include_once 'mm_vocab.module';
// register drush commands
function mm_vocab_drush_command() {
$items = array();
// register individual Drush commands
$items['mm-vocabulary-sync'] = array(
'description' => dt('Syncs the Media Magnet vocabularies'),
'drupal dependencies' => array('mm_vocab'),
'examples' => array(
'Example 1' => 'drush mm-vocabulary-sync',
'Example 2' => 'drush mm-vsync',
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
'aliases' => array('mm-vsync'),
);
// return list of drush commands
return $items;
}
// mm-vocabulary-sync function
function drush_mm_vocab_mm_vocabulary_sync() {
drush_log('Syncing vocabularies now...', 'ok');
mm_vocab_cron();
drush_log('Sync complete!', 'ok');
}
name = Media Magnet Vocabularies
description = Vocabularies and synchronization logic for Media Magnet
core = 7.x
package = Media Magnet
version = 7.x-1.0
project = mm
dependencies[] = entityreference
dependencies[] = features
dependencies[] = taxonomy
dependencies[] = views
files[] = MmVocabSyncService.inc
<?php
/**
* @file
* Installation methods.
*/
/**
* Implements hook_install().
*/
function mm_vocab_install() {
MmVocabSyncService::sync();
}
/**
* Implements hook_uninstall().
*/
function mm_vocab_uninstall() {
MmVocabSyncService::uninstall();
}
\ No newline at end of file
<?php
/**
* @file
* Code for the Media Magnet Vocabularies feature.
*/
// include_once 'mm_vocab.features.inc';
/**
* @file
* Code for the OSU News feature.
*/
include_once 'mm_vocab.widget.inc';
/**
* Implements hook_cron().
*/
function mm_vocab_cron() {
MmVocabSyncService::sync();
}
<?php
/**
* @file
* mm_vocab.views_default.inc
*/
/**
* Implements hook_views_default_views().
*/
function mm_vocab_views_default_views() {
$export = array();
$view = new view();
$view->name = 'mm_autocomplete';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'taxonomy_term_data';
$view->human_name = 'mm_autocomplete';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Taxonomy term: Display name */
$handler->display->display_options['fields']['field_mm_display_name']['id'] = 'field_mm_display_name';
$handler->display->display_options['fields']['field_mm_display_name']['table'] = 'field_data_field_mm_display_name';
$handler->display->display_options['fields']['field_mm_display_name']['field'] = 'field_mm_display_name';
$handler->display->display_options['fields']['field_mm_display_name']['label'] = '';
$handler->display->display_options['fields']['field_mm_display_name']['element_label_colon'] = FALSE;
/* Display: Entity Reference */
$handler = $view->new_display('entityreference', 'Entity Reference', 'entityreference_1');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'entityreference_style';
$handler->display->display_options['style_options']['search_fields'] = array(
'field_mm_display_name' => 'field_mm_display_name',
'name' => 0,
);
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'entityreference_fields';
$handler->display->display_options['defaults']['row_options'] = FALSE;
$export['mm_autocomplete'] = $view;
return $export;
}
<?php
<?php
/**
* @file
* mm_vocab_field.features.field_base.inc
*/
/**
* Implements hook_field_default_field_bases().
*/
function mm_vocab_field_field_default_field_bases() {
$field_bases = array();
// Exported field_base: 'field_media_magnet_keywords'
$field_bases['field_media_magnet_keywords'] = array(
'active' => 1,
'cardinality' => -1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_media_magnet_keywords',
'indexes' => array(
'target_id' => array(
0 => 'target_id',
),
),
'locked' => 0,
'module' => 'entityreference',
'settings' => array(
'handler' => 'views',
'handler_settings' => array(
'behaviors' => array(
'views-select-list' => array(
'status' => 1,
),
),
'view' => array(
'args' => array(),
'display_name' => 'entityreference_1',
'view_name' => 'media_magnet_filter',
),
),
'target_type' => 'taxonomy_term',
),
'translatable' => 0,
'type' => 'entityreference',
);
return $field_bases;
}
<?php
/**
* @file
* mm_vocab_field.features.inc
*/
/**
* Implements hook_views_api().
*/
function mm_vocab_field_views_api($module = NULL, $api = NULL) {
return array("api" => "3.0");
}
name = Media Magnet Vocabulary Feature
description = Feature for getting Media Magnet vocabulary field imported
core = 7.x
package = Media Magnet
version = 7.x-1.0
dependencies[] = entityreference
dependencies[] = features
dependencies[] = mm_vocab
dependencies[] = views
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
features[field_base][] = field_media_magnet_keywords
features[views_view][] = media_magnet_filter
features_exclude[dependencies][ctools] = ctools
<?php
/**
* @file
* Code for the Media Magnet Vocabulary Feature feature.
*/
include_once 'mm_vocab_field.features.inc';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment