From 477eb893471e79d9b1c6e46ceb064141f4687e6c Mon Sep 17 00:00:00 2001 From: James Fuller Date: Fri, 6 Jun 2014 16:41:57 -0500 Subject: [PATCH] Changes for OG in News --- cod_news/cod_news.features.field_instance.inc | 66 +++++++++++++++++++++++++++ cod_news/cod_news.info | 12 ++++- cod_news/cod_news.install | 12 +++++ cod_news/cod_news.strongarm.inc | 30 ++++++++++++ cod_news/cod_news.views_default.inc | 35 ++++++++++++-- 5 files changed, 151 insertions(+), 4 deletions(-) create mode 100644 cod_news/cod_news.install diff --git a/cod_news/cod_news.features.field_instance.inc b/cod_news/cod_news.features.field_instance.inc index f6a428a..65c4f7c 100644 --- a/cod_news/cod_news.features.field_instance.inc +++ b/cod_news/cod_news.features.field_instance.inc @@ -61,9 +61,75 @@ function cod_news_field_default_field_instances() { 'widget_type' => 'text_textarea_with_summary', ); + // Exported field_instance: 'node-news-og_group_ref' + $field_instances['node-news-og_group_ref'] = array( + 'bundle' => 'news', + 'default_value' => NULL, + 'deleted' => 0, + 'description' => '', + 'display' => array( + 'default' => array( + 'label' => 'above', + 'module' => 'og_ui', + 'settings' => array(), + 'type' => 'og_list_default', + 'weight' => 1, + ), + 'listing' => array( + 'label' => 'above', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => 0, + ), + 'teaser' => array( + 'label' => 'above', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => 0, + ), + ), + 'entity_type' => 'node', + 'field_name' => 'og_group_ref', + 'label' => 'Groups audience', + 'required' => FALSE, + 'settings' => array( + 'behaviors' => array( + 'og_widget' => array( + 'admin' => array( + 'widget_type' => 'entityreference_autocomplete', + ), + 'default' => array( + 'widget_type' => 'options_select', + ), + 'status' => TRUE, + ), + ), + 'user_register_form' => FALSE, + ), + 'view modes' => array( + 'full' => array( + 'custom settings' => FALSE, + 'label' => 'Full', + 'type' => 'og_list_default', + ), + 'teaser' => array( + 'custom settings' => FALSE, + 'label' => 'Teaser', + 'type' => 'og_list_default', + ), + ), + 'widget' => array( + 'module' => 'og', + 'settings' => array(), + 'type' => 'og_complex', + 'weight' => 31, + ), + ); + // Translatables // Included for use with string extractors like potx. t('Body'); + t('Groups audience'); return $field_instances; } diff --git a/cod_news/cod_news.info b/cod_news/cod_news.info index ee6502e..8d7410d 100644 --- a/cod_news/cod_news.info +++ b/cod_news/cod_news.info @@ -3,17 +3,22 @@ description = News items for events core = 7.x package = COD project = cod_news -install_option = cod dependencies[] = cod_events dependencies[] = comment +dependencies[] = ctools dependencies[] = features dependencies[] = menu +dependencies[] = og +dependencies[] = og_ui dependencies[] = strongarm +dependencies[] = text dependencies[] = views +dependencies[] = views_content features[ctools][] = strongarm:strongarm:1 features[ctools][] = views:views_default:3.0 features[features_api][] = api:2 features[field_instance][] = node-news-body +features[field_instance][] = node-news-og_group_ref features[node][] = news features[variable][] = comment_anonymous_news features[variable][] = comment_default_mode_news @@ -22,5 +27,10 @@ features[variable][] = comment_form_location_news features[variable][] = comment_news features[variable][] = comment_preview_news features[variable][] = comment_subject_field_news +features[variable][] = menu_options_news +features[variable][] = menu_parent_news features[variable][] = node_options_news +features[variable][] = node_preview_news +features[variable][] = node_submitted_news features[views_view][] = cod_news +install_option = cod diff --git a/cod_news/cod_news.install b/cod_news/cod_news.install new file mode 100644 index 0000000..31a608f --- /dev/null +++ b/cod_news/cod_news.install @@ -0,0 +1,12 @@ + array('field_instance', 'variable', 'views_view'), + ); + features_revert($revert); + + return array(); +} diff --git a/cod_news/cod_news.strongarm.inc b/cod_news/cod_news.strongarm.inc index 14c6583..660f3b8 100644 --- a/cod_news/cod_news.strongarm.inc +++ b/cod_news/cod_news.strongarm.inc @@ -62,6 +62,22 @@ function cod_news_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_news'; + $strongarm->value = array( + 0 => 'main-menu', + ); + $export['menu_options_news'] = $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_news'; + $strongarm->value = 'main-menu:0'; + $export['menu_parent_news'] = $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_news'; $strongarm->value = array( 0 => 'status', @@ -69,5 +85,19 @@ function cod_news_strongarm() { ); $export['node_options_news'] = $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_news'; + $strongarm->value = '1'; + $export['node_preview_news'] = $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_news'; + $strongarm->value = 1; + $export['node_submitted_news'] = $strongarm; + return $export; } diff --git a/cod_news/cod_news.views_default.inc b/cod_news/cod_news.views_default.inc index 36dc6c0..5f58e50 100644 --- a/cod_news/cod_news.views_default.inc +++ b/cod_news/cod_news.views_default.inc @@ -29,8 +29,8 @@ function cod_news_views_default_views() { $handler->display->display_options['query']['type'] = 'views_query'; $handler->display->display_options['query']['options']['query_comment'] = FALSE; $handler->display->display_options['exposed_form']['type'] = 'basic'; - $handler->display->display_options['pager']['type'] = 'full'; - $handler->display->display_options['pager']['options']['items_per_page'] = '10'; + $handler->display->display_options['pager']['type'] = 'mini'; + $handler->display->display_options['pager']['options']['items_per_page'] = '3'; $handler->display->display_options['pager']['options']['offset'] = '0'; $handler->display->display_options['pager']['options']['id'] = '0'; $handler->display->display_options['style_plugin'] = 'default'; @@ -40,7 +40,13 @@ function cod_news_views_default_views() { $handler->display->display_options['empty']['area']['table'] = 'views'; $handler->display->display_options['empty']['area']['field'] = 'area'; $handler->display->display_options['empty']['area']['label'] = 'Empty text'; - $handler->display->display_options['empty']['area']['content'] = 'No news items have been published.'; + $handler->display->display_options['empty']['area']['empty'] = TRUE; + $handler->display->display_options['empty']['area']['content'] = 'No news items have been published to this event.'; + $handler->display->display_options['empty']['area']['format'] = 'filtered_html'; + /* Relationship: OG membership: OG membership from Node */ + $handler->display->display_options['relationships']['og_membership_rel']['id'] = 'og_membership_rel'; + $handler->display->display_options['relationships']['og_membership_rel']['table'] = 'node'; + $handler->display->display_options['relationships']['og_membership_rel']['field'] = 'og_membership_rel'; /* Field: Content: Title */ $handler->display->display_options['fields']['title']['id'] = 'title'; $handler->display->display_options['fields']['title']['table'] = 'node'; @@ -58,6 +64,16 @@ function cod_news_views_default_views() { $handler->display->display_options['sorts']['sticky']['table'] = 'node'; $handler->display->display_options['sorts']['sticky']['field'] = 'sticky'; $handler->display->display_options['sorts']['sticky']['order'] = 'DESC'; + /* Contextual filter: OG membership: Group ID */ + $handler->display->display_options['arguments']['gid']['id'] = 'gid'; + $handler->display->display_options['arguments']['gid']['table'] = 'og_membership'; + $handler->display->display_options['arguments']['gid']['field'] = 'gid'; + $handler->display->display_options['arguments']['gid']['relationship'] = 'og_membership_rel'; + $handler->display->display_options['arguments']['gid']['default_action'] = 'empty'; + $handler->display->display_options['arguments']['gid']['default_argument_type'] = 'fixed'; + $handler->display->display_options['arguments']['gid']['summary']['number_of_records'] = '0'; + $handler->display->display_options['arguments']['gid']['summary']['format'] = 'default_summary'; + $handler->display->display_options['arguments']['gid']['summary_options']['items_per_page'] = '25'; /* Filter criterion: Content: Published */ $handler->display->display_options['filters']['status']['id'] = 'status'; $handler->display->display_options['filters']['status']['table'] = 'node'; @@ -105,6 +121,19 @@ function cod_news_views_default_views() { $handler->display->display_options['defaults']['row_plugin'] = FALSE; $handler->display->display_options['row_plugin'] = 'node'; $handler->display->display_options['defaults']['row_options'] = FALSE; + + /* Display: Multi News Item pane */ + $handler = $view->new_display('panel_pane', 'Multi News Item pane', 'panel_pane_1'); + $handler->display->display_options['argument_input'] = array( + 'gid' => array( + 'type' => 'panel', + 'context' => 'entity:comment.author', + 'context_optional' => 0, + 'panel' => '0', + 'fixed' => '', + 'label' => 'OG membership: Group ID', + ), + ); $export['cod_news'] = $view; return $export; -- 1.8.4.2