Skip to content
Permalink
Browse files

Initial commit: Equipment asset type, View, and Page Manager variant.

  • Loading branch information...
mstenta committed Dec 8, 2014
0 parents commit 67539de3dc986b54ae8e88def4703f5f501bf68b
@@ -0,0 +1,40 @@
<?php
/**
* @file
* farm_equipment.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function farm_equipment_ctools_plugin_api() {
list($module, $api) = func_get_args();
if ($module == "page_manager" && $api == "pages_default") {
return array("version" => "1");
}
list($module, $api) = func_get_args();
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}
/**
* Implements hook_views_api().
*/
function farm_equipment_views_api() {
return array("version" => "3.0");
}
/**
* Implements hook_default_farm_asset_type().
*/
function farm_equipment_default_farm_asset_type() {
$items = array();
$items['equipment'] = entity_import('farm_asset_type', '{
"type" : "equipment",
"label" : "Equipment",
"weight" : 0,
"rdf_mapping" : []
}');
return $items;
}
@@ -0,0 +1,18 @@
name = Farm Equipment
description = Features for managing farm equipment.
core = 7.x
package = Farm
dependencies[] = ctools
dependencies[] = entity
dependencies[] = farm_asset
dependencies[] = page_manager
dependencies[] = strongarm
dependencies[] = views
features[ctools][] = page_manager:pages_default:1
features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0
features[farm_asset_type][] = equipment
features[features_api][] = api:1
features[page_manager_handlers][] = farm_asset_view_panel_context
features[variable][] = pathauto_farm_asset_equipment_pattern
features[views_view][] = farm_equipment
@@ -0,0 +1,7 @@
<?php
/**
* @file
* Code for the Farm Equipment feature.
*/

include_once 'farm_equipment.features.inc';
@@ -0,0 +1,115 @@
<?php
/**
* @file
* farm_equipment.pages_default.inc
*/
/**
* Implements hook_default_page_manager_handlers().
*/
function farm_equipment_default_page_manager_handlers() {
$export = array();
$handler = new stdClass();
$handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
$handler->api_version = 1;
$handler->name = 'farm_asset_view_panel_context';
$handler->task = 'farm_asset_view';
$handler->subtask = '';
$handler->handler = 'panel_context';
$handler->weight = 2;
$handler->conf = array(
'title' => 'Equipment View',
'no_blocks' => 0,
'pipeline' => 'standard',
'body_classes_to_remove' => '',
'body_classes_to_add' => '',
'css_id' => '',
'css' => '',
'contexts' => array(),
'relationships' => array(),
'access' => array(
'plugins' => array(
0 => array(
'name' => 'entity_bundle:farm_asset',
'settings' => array(
'type' => array(
'equipment' => 'equipment',
),
),
'context' => 'argument_entity_id:farm_asset_1',
'not' => FALSE,
),
),
'logic' => 'and',
),
);
$display = new panels_display();
$display->layout = 'twocol';
$display->layout_settings = array();
$display->panel_settings = array(
'style_settings' => array(
'default' => NULL,
'left' => NULL,
'right' => NULL,
),
);
$display->cache = array();
$display->title = '%farm_asset:name';
$display->uuid = '83d057c3-0fe2-4a8f-951b-a86276093113';
$display->content = array();
$display->panels = array();
$pane = new stdClass();
$pane->pid = 'new-14a5b1a8-a389-4c09-badf-1d90f1a93d3e';
$pane->panel = 'left';
$pane->type = 'entity_view';
$pane->subtype = 'farm_asset';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'view_mode' => 'full',
'context' => 'argument_entity_id:farm_asset_1',
'override_title' => 0,
'override_title_text' => '',
);
$pane->cache = array();
$pane->style = array(
'settings' => NULL,
);
$pane->css = array();
$pane->extras = array();
$pane->position = 0;
$pane->locks = array();
$pane->uuid = '14a5b1a8-a389-4c09-badf-1d90f1a93d3e';
$display->content['new-14a5b1a8-a389-4c09-badf-1d90f1a93d3e'] = $pane;
$display->panels['left'][0] = 'new-14a5b1a8-a389-4c09-badf-1d90f1a93d3e';
$pane = new stdClass();
$pane->pid = 'new-7d838235-4b44-4466-a902-474308b0fd6b';
$pane->panel = 'right';
$pane->type = 'views_panes';
$pane->subtype = 'farm_log_movement-panel_pane_1';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'context' => array(
0 => 'argument_entity_id:farm_asset_1',
),
);
$pane->cache = array();
$pane->style = array(
'settings' => NULL,
);
$pane->css = array();
$pane->extras = array();
$pane->position = 0;
$pane->locks = array();
$pane->uuid = '7d838235-4b44-4466-a902-474308b0fd6b';
$display->content['new-7d838235-4b44-4466-a902-474308b0fd6b'] = $pane;
$display->panels['right'][0] = 'new-7d838235-4b44-4466-a902-474308b0fd6b';
$display->hide_title = PANELS_TITLE_FIXED;
$display->title_pane = '0';
$handler->conf['display'] = $display;
$export['farm_asset_view_panel_context'] = $handler;
return $export;
}
@@ -0,0 +1,21 @@
<?php
/**
* @file
* farm_equipment.strongarm.inc
*/
/**
* Implements hook_strongarm().
*/
function farm_equipment_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 = 'pathauto_farm_asset_equipment_pattern';
$strongarm->value = 'farm/equipment/[farm_asset:name]';
$export['pathauto_farm_asset_equipment_pattern'] = $strongarm;
return $export;
}
@@ -0,0 +1,167 @@
<?php
/**
* @file
* farm_equipment.views_default.inc
*/
/**
* Implements hook_views_default_views().
*/
function farm_equipment_views_default_views() {
$export = array();
$view = new view();
$view->name = 'farm_equipment';
$view->description = '';
$view->tag = 'farm_livestock';
$view->base_table = 'farm_asset';
$view->human_name = 'Farm Equipment';
$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'] = 'Equipment';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['access']['perm'] = 'view any equipment farm assets';
$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['pager']['options']['items_per_page'] = '50';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
'id' => 'id',
'name' => 'name',
'field_farm_move_to' => 'field_farm_move_to',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
'id' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'name' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'field_farm_move_to' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
/* No results behavior: Global: Unfiltered text */
$handler->display->display_options['empty']['area_text_custom']['id'] = 'area_text_custom';
$handler->display->display_options['empty']['area_text_custom']['table'] = 'views';
$handler->display->display_options['empty']['area_text_custom']['field'] = 'area_text_custom';
$handler->display->display_options['empty']['area_text_custom']['empty'] = TRUE;
$handler->display->display_options['empty']['area_text_custom']['content'] = 'No equipment found.';
/* Relationship: Farm asset: Latest movement */
$handler->display->display_options['relationships']['latest_movement']['id'] = 'latest_movement';
$handler->display->display_options['relationships']['latest_movement']['table'] = 'farm_asset';
$handler->display->display_options['relationships']['latest_movement']['field'] = 'latest_movement';
/* Field: Farm asset: Farm asset ID */
$handler->display->display_options['fields']['id']['id'] = 'id';
$handler->display->display_options['fields']['id']['table'] = 'farm_asset';
$handler->display->display_options['fields']['id']['field'] = 'id';
$handler->display->display_options['fields']['id']['exclude'] = TRUE;
/* Field: Farm asset: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'farm_asset';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['alter']['make_link'] = TRUE;
$handler->display->display_options['fields']['name']['alter']['path'] = 'farm/asset/[id]';
/* Field: Log: To */
$handler->display->display_options['fields']['field_farm_move_to']['id'] = 'field_farm_move_to';
$handler->display->display_options['fields']['field_farm_move_to']['table'] = 'field_data_field_farm_move_to';
$handler->display->display_options['fields']['field_farm_move_to']['field'] = 'field_farm_move_to';
$handler->display->display_options['fields']['field_farm_move_to']['relationship'] = 'latest_movement';
$handler->display->display_options['fields']['field_farm_move_to']['label'] = 'Location';
/* Sort criterion: Farm asset: Name */
$handler->display->display_options['sorts']['name']['id'] = 'name';
$handler->display->display_options['sorts']['name']['table'] = 'farm_asset';
$handler->display->display_options['sorts']['name']['field'] = 'name';
$handler->display->display_options['sorts']['name']['exposed'] = TRUE;
$handler->display->display_options['sorts']['name']['expose']['label'] = 'Name';
/* Filter criterion: Farm asset: Farm asset type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'farm_asset';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'equipment' => 'equipment',
);
$handler->display->display_options['filters']['type']['group'] = 1;
/* Filter criterion: Farm asset: Name */
$handler->display->display_options['filters']['name']['id'] = 'name';
$handler->display->display_options['filters']['name']['table'] = 'farm_asset';
$handler->display->display_options['filters']['name']['field'] = 'name';
$handler->display->display_options['filters']['name']['operator'] = 'contains';
$handler->display->display_options['filters']['name']['group'] = 1;
$handler->display->display_options['filters']['name']['exposed'] = TRUE;
$handler->display->display_options['filters']['name']['expose']['operator_id'] = 'name_op';
$handler->display->display_options['filters']['name']['expose']['label'] = 'Name';
$handler->display->display_options['filters']['name']['expose']['operator'] = 'name_op';
$handler->display->display_options['filters']['name']['expose']['identifier'] = 'name';
$handler->display->display_options['filters']['name']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
30037204 => 0,
200153887 => 0,
125843996 => 0,
173712484 => 0,
196317508 => 0,
146437786 => 0,
);
/* Display: All equipment (Page) */
$handler = $view->new_display('page', 'All equipment (Page)', 'page');
$handler->display->display_options['path'] = 'admin/farm/equipment/list';
$handler->display->display_options['menu']['type'] = 'default tab';
$handler->display->display_options['menu']['title'] = 'List';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['name'] = 'management';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['menu']['context_only_inline'] = 0;
$handler->display->display_options['tab_options']['type'] = 'tab';
$handler->display->display_options['tab_options']['title'] = 'Equipment';
$handler->display->display_options['tab_options']['weight'] = '10';
/* Display: Equipment by area (Page) */
$handler = $view->new_display('page', 'Equipment by area (Page)', 'page_1');
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: Log: To (field_farm_move_to) */
$handler->display->display_options['arguments']['field_farm_move_to_tid']['id'] = 'field_farm_move_to_tid';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['table'] = 'field_data_field_farm_move_to';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['field'] = 'field_farm_move_to_tid';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['relationship'] = 'latest_movement';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['default_action'] = 'not found';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['title_enable'] = TRUE;
$handler->display->display_options['arguments']['field_farm_move_to_tid']['title'] = 'Equipment in %1';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['specify_validation'] = TRUE;
$handler->display->display_options['arguments']['field_farm_move_to_tid']['validate']['type'] = 'taxonomy_term';
$handler->display->display_options['arguments']['field_farm_move_to_tid']['validate_options']['vocabularies'] = array(
'farm_areas' => 'farm_areas',
);
$handler->display->display_options['path'] = 'farm/area/%/equipment';
$export['farm_equipment'] = $view;
return $export;
}

0 comments on commit 67539de

Please sign in to comment.
You can’t perform that action at this time.