@@ -33,17 +38,18 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
}
/**
* Provide a form for setting options.
* Build the form for setting the row plugin's options.
*/
functionoptions_form(&$form,&$form_state){
publicfunctionoptions_form(&$form,&$form_state){
parent::options_form($form,$form_state);
// Build the select dropdown for the date field that the user wants to use
// to populate the date fields in VEVENTs.
// Build the select dropdown for the Date field that the user wants to use
// to populate the date properties in VEVENTs.
$data=date_views_fields($this->base_table);
$options=array();
foreach($data['name']as$item=>$value){
// We only want to see one value for each field, skip '_value2', and other columns.
// We only want to see one value for each field, so we need to
// skip '_value2' and other columns.
if($item==$value['fromto'][0]){
$options[$item]=$value['label'];
}
...
...
@@ -58,7 +64,7 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
'#required'=>TRUE,
);
$form['instructions']=array(
// The surrounding <div> is necessary to ensure that the settings dialog expands to show everything.
// The surrounding <div> ensures that the settings dialog expands.
'#prefix'=>'<div style="font-size: 90%">',
'#suffix'=>'</div>',
'#markup'=>t("Each item's Title and iCal view mode will be included as the SUMMARY and DESCRIPTION elements (respectively) in the VEVENTs output by this View.
...
...
@@ -101,18 +107,21 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
);
}
functionpre_render($values){
// @TODO When the date is coming in through a relationship, the nid
// of the view is not the right node to use, then we need the related node.
// Need to sort out how that should be handled.
/**
* Preload the list of entities which will appear in the view.
*
* @TODO: When the date is coming in through a relationship, the nid
* of the view is not the right node to use, then we need the related node.
* Need to sort out how that should be handled.
*/
publicfunctionpre_render($values){
// Preload each entity used in this view from the cache.
// Provides all the entity values relatively cheaply, and we don't
// need to do it repeatedly for the same entity if there are
// multiple results for one entity.
$ids=array();
foreach($valuesas$row){
// Use the $id as the key so we don't create more than one value per entity.
// Use the $id as the key so we create only value per entity.
$id=$row->{$this->field_alias};
// Node revisions need special loading.
...
...
@@ -140,8 +149,10 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
}
}
functionrender($row){
global$base_url;
/**
* Renders the entities returned by the view into event arrays.
*/
publicfunctionrender($row){
$id=$row->{$this->field_alias};
if(!is_numeric($id)){
returnNULL;
...
...
@@ -157,20 +168,17 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {