Skip to content

Commit

Permalink
add townsquare news feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ahowze committed Jun 30, 2012
1 parent 13d4c1f commit 8d6a52c
Show file tree
Hide file tree
Showing 7 changed files with 339 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?php
/**
* @file
* townsquare_news.features.field.inc
*/

/**
* Implements hook_field_default_fields().
*/
function townsquare_news_field_default_fields() {
$fields = array();

// Exported field: 'node-news-body'.
$fields['node-news-body'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(
0 => 'node',
),
'field_name' => 'body',
'foreign keys' => array(
'format' => array(
'columns' => array(
'format' => 'format',
),
'table' => 'filter_format',
),
),
'indexes' => array(
'format' => array(
0 => 'format',
),
),
'locked' => '0',
'module' => 'text',
'settings' => array(
'field_permissions' => array(
'create' => 0,
'edit' => 0,
'edit own' => 0,
'view' => 0,
'view own' => 0,
),
),
'translatable' => '1',
'type' => 'text_with_summary',
),
'field_instance' => array(
'bundle' => 'news',
'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' => -4,
),
),
);

// Translatables
// Included for use with string extractors like potx.
t('Body');

return $fields;
}
39 changes: 39 additions & 0 deletions modules/townsquare/townsquare_news/townsquare_news.features.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* @file
* townsquare_news.features.inc
*/

/**
* Implements hook_ctools_plugin_api().
*/
function townsquare_news_ctools_plugin_api() {
list($module, $api) = func_get_args();
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}

/**
* Implements hook_views_api().
*/
function townsquare_news_views_api() {
return array("version" => "3.0");
}

/**
* Implements hook_node_info().
*/
function townsquare_news_node_info() {
$items = array(
'news' => array(
'name' => t('News'),
'base' => 'node_content',
'description' => '',
'has_title' => '1',
'title_label' => t('Title'),
'help' => '',
),
);
return $items;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* @file
* townsquare_news.features.menu_links.inc
*/

/**
* Implements hook_menu_default_menu_links().
*/
function townsquare_news_menu_default_menu_links() {
$menu_links = array();

// Exported menu link: main-menu:news
$menu_links['main-menu:news'] = array(
'menu_name' => 'main-menu',
'link_path' => 'news',
'router_path' => 'news',
'link_title' => 'News',
'options' => array(),
'module' => 'system',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '0',
);
// Translatables
// Included for use with string extractors like potx.
t('News');


return $menu_links;
}
26 changes: 26 additions & 0 deletions modules/townsquare/townsquare_news/townsquare_news.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name = Townsquare News
core = 7.x
package = Townsquare
version = 7.x-1.0-dev
project = townsquare_news
dependencies[] = ctools
dependencies[] = features
dependencies[] = field_sql_storage
dependencies[] = menu
dependencies[] = node
dependencies[] = strongarm
dependencies[] = text
dependencies[] = townsquare_volunteer
dependencies[] = views
features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0
features[features_api][] = api:1
features[field][] = node-news-body
features[menu_links][] = main-menu:news
features[node][] = 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][] = townsquare_news
7 changes: 7 additions & 0 deletions modules/townsquare/townsquare_news/townsquare_news.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
/**
* @file
* Code for the Townsquare News feature.
*/

include_once 'townsquare_news.features.inc';
53 changes: 53 additions & 0 deletions modules/townsquare/townsquare_news/townsquare_news.strongarm.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/**
* @file
* townsquare_news.strongarm.inc
*/

/**
* Implements hook_strongarm().
*/
function townsquare_news_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 = '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',
);
$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 = '0';
$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;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php
/**
* @file
* townsquare_news.views_default.inc
*/

/**
* Implements hook_views_default_views().
*/
function townsquare_news_views_default_views() {
$export = array();

$view = new view;
$view->name = 'townsquare_news';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Townsquare News';
$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['title'] = 'Townsquare News';
$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['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['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'news' => 'news',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'news';
$handler->display->display_options['menu']['type'] = 'normal';
$handler->display->display_options['menu']['title'] = 'News';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['name'] = 'main-menu';
$handler->display->display_options['menu']['context'] = 0;
$export['townsquare_news'] = $view;

return $export;
}

0 comments on commit 8d6a52c

Please sign in to comment.