CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • CiviEvents: Display "Defaults" has an invalid style plugin.
Pages: [1]

Author Topic: CiviEvents: Display "Defaults" has an invalid style plugin.  (Read 3558 times)

wftl

  • I’m new here
  • *
  • Posts: 28
  • Karma: 4
    • Writer and Free Thinker at Large
CiviEvents: Display "Defaults" has an invalid style plugin.
September 01, 2011, 01:50:49 pm
Hello everyone. This is a real stumper and one for which I've spent far too much time with nothing to show for it. When trying to use, or view, or edit the views on the civicrm_events view, I always get an error:

Notice: Trying to get property of non-object in views_ui_get_display_tab() (line 1466 of /home/openphar/public_html/sites/all/modules/views/includes/admin.inc).
Display "Defaults" has an invalid style plugin.


If I look at the "Events Page" tab, it further states "Error: Display calendar_1 refers to a plugin named 'calendar', but that plugin is not available." When I click "Events Block", I get "Error: Display calendar_block_1 refers to a plugin named 'calendar_block', but that plugin is not available."

The short and sweet of it is that it seems impossible to use Views to access CiviEvents calendar blocks or displays when using Drupal 7 ad CiviCRM 4.0.5. Thinking I screwed up on my customer site where this first occurred, I installed a brand new Drupal 7.8 site with CiviCRM 4.0.5 using only the sample data option, installed Views, Calendar, Date, and Ctools (to satisfy prerequisites), and tried again.

In all cases, I also get "Unable to preview due to validation errors."

What needs to be done in order to successfully use Calendar Views with CiviEvents when using Drupal 7 and CiviCRM 4?

Please help me Civiwan Kenobi. You're my only hope.

--
Marcel (Writer and Free Thinker at Large) Gagné
Note: This massagee wos nat speel or gramer-checkered.

wftl

  • I’m new here
  • *
  • Posts: 28
  • Karma: 4
    • Writer and Free Thinker at Large
Re: CiviEvents: Display "Defaults" has an invalid style plugin.
September 01, 2011, 06:39:03 pm
Okay, lots of digging and I'm starting to see where things are falling apart.

Views has changed dramatically and it affects a number of modules by default. Unfortunately, one of those modules is CiviCRM. Here's what I've found so far.

Over in modules/civicrm/drupal/modules/views/civicrm.views_default.inc , we find the core of the problem. References to plugins that were created in the first incarnation of Views, Date, and Calendar. Trouble is, I don't know how to fix it. 

Anyone?

-- Marcel

wftl

  • I’m new here
  • *
  • Posts: 28
  • Karma: 4
    • Writer and Free Thinker at Large
Re: CiviEvents: Display "Defaults" has an invalid style plugin.
September 02, 2011, 08:37:19 am
Updates . . .

The civicrm.views_default.inc is based on the Calendar module, version 7.x-1.x which has been completely abandoned due to the changes in Views 3.

Trying, as best I can given I'm not really familiar with this, to modify the civicrm.views_default.in to reflect the one in calendar.views_default.inc ; if you want to help, feel free.  ;D

I have attached a diff file of my changes so far. I appear to be making progress. No solution yet, but moving forward.

-- Marcel
« Last Edit: September 02, 2011, 10:40:08 am by wftl »

johndieter

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
  • CiviCRM version: 4.1 beta 2
  • CMS version: drupal 7.10
  • MySQL version: 5
  • PHP version: 5
Re: CiviEvents: Display "Defaults" has an invalid style plugin.
September 06, 2011, 01:13:20 pm
this is a big problem. any more progress on this?

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: CiviEvents: Display "Defaults" has an invalid style plugin.
September 22, 2011, 08:55:24 am

So here' the lay of the land.  Keep in mind you are using alpha code with Calendar and Date module, given that D7 depends on PHP5.2 the date module went through a massive rewrite.  So that said I would fully expect this to be a rocky road until those modules get stable (literally Date worked in alpha3 and broke in alpha4)


Concerning Date as of 7.x.2.0-alpha4 you have to pass ['is date'] => TRUE in the hook_views_data call (which is in the civicrm.views.inc file) for arguments and filters.  I'll submit a patch soon there.  This will expose the CiviCRM date fields to the Date API, which is the first step.


Sample to fix Date API
Code: [Select]
    //Scheduled Activity Date
    $data['civicrm_activity']['activity_date_time'] = array(
                                                            'title' => t('Scheduled Activity Date'),
                                                            'help' => t('The Date and Time the activity is scheduled to happen.'),
                                                            'field' => array(
                                                                             'handler' => 'civicrm_handler_field_datetime',
                                                                             'click sortable' => TRUE,
                                                                             ),

                                                            'filter' => array(
                                                                              'handler' => 'civicrm_handler_filter_datetime',
                                                                              'is date' => TRUE,
                                                                              ),

                                                            'sort' => array(
                                                                            'handler' => 'civicrm_handler_sort_date',
                                                                            ),
                                                            'argument' => array (
                                                                                'handler' => 'date_views_argument_handler',
                                                                                'empty field name' => t('Undated'),
                                                                                'is date' => TRUE,
                                                                                 ),
                                                            );
    civicrm_views_add_date_arguments($data['civicrm_activity'],array('title' =>'Scheduled Activity Date',
                                                                     'name' => 'activity_date_time'));

Calendar is a whole different story :(  I don't know for sure yet but it appears you now have to ship plugin handlers for each entity you want to to use the Calendar style/format (In D6 all you needed was Date API integration and Calendar was handled from there).  That or there is a setting somewhere where you tell Calendar Module that it needs to work with different CiviCRM based views.  I'm not 100% sure what this is gonna take, but I'ma little worried that Calendar is expecting Drupal Entities.  I believe models for this would be the calendar_views_plugins()  function an the calendar_plugin_row_node class that ship with the Calendar module (mind you this may be a simple cut and paste :).

Until the Calander thing is fixed the messing with calendar.views_default.inc will be a dead end.
http://www.rootyhollow.com

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: CiviEvents: Display "Defaults" has an invalid style plugin.
September 25, 2011, 06:27:59 pm
http://issues.civicrm.org/jira/browse/CRM-8929

This is the issue where the Date Module integration is being patched for 4.0 and 4.1.  While fixes will be attached to the ticket for 4.0.x I'm listing the fix version as 4.1 as I suspect Date Module will not be stable for a little while, so there will be more issues.
http://www.rootyhollow.com

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: CiviEvents: Display "Defaults" has an invalid style plugin.
September 30, 2011, 09:26:11 am
I'm finally getting a little bit of time to dive back in here :)

Adding the code below to civicrm.views.inc allows Calendar Items to be an option under Format/Show for CiviCRM event views (you need to wipe Drupal's cache, ie "drush cc all".  this is pointing to a new file /sites/all/modules/civicrm/drupal/modules/views/plugins/civicrm_event_plugin_row_node.inc which for now is a copy of calander_plugin_row_node.inc.  This is the plugin that tells Views what the heck to do with the data from CiviCRM. At this time is doesn't do a thing, as the source file is expecting Drupal nodes :) It's a small step but it's progress.
Code: [Select]
/**
 * Implements hook_views_plugins
 */
function civicrm_views_plugins() {
  $views_path = drupal_get_path('module', 'views');
  $civicrm_module_path = drupal_get_path('module', 'civicrm');

  $data = array(
    'row' => array(
      'civicrm_event_calendar' => array(
        'title' => t('Calendar Items'),
        'help' => t('Displays each selected node as a Calendar item.'),
        'handler' => 'civicrm_event_plugin_row_node',
        'path' => "$civicrm_module_path/modules/views/plugins",
        'base' => array('civicrm_event'),
        'uses options' => TRUE,
        'uses fields' => TRUE,
        'type' => 'normal',
      ),
    ),
  );
  return $data;
}
http://www.rootyhollow.com

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: CiviEvents: Display "Defaults" has an invalid style plugin.
October 16, 2011, 04:56:42 pm
Okay so this is fixed in two issue, both issues are committed to the 4.0 and trunk (ie 4.1) branches.  They work on 7.x.2.0-alpha4 and 7.x-3.0-alpha1 for the date and calendar modules respectively.

Date module is fixed here http://issues.civicrm.org/jira/browse/CRM-8929
The Calendar module is fixed here http://issues.civicrm.org/jira/browse/CRM-9046

The patch for on 4.0 date module can be found here https://fisheye2.atlassian.com/rdiff/CiviCRM/branches/v4.0/drupal/modules/views/civicrm.views.inc?r1=36263&r2=36408&u&N.  The patch for 4.0 an Calendar is attached to CRM-9046.

Also, you need to patch the Calendar module ala  this patch http://drupal.org/node/1236610#comment-4833880 to the Calendar module

Please test these out, and expect to have to clear the caches a bunch (note: if using Drush Views and "drush cc all" don't always get along you may have to clear the caches manually)
« Last Edit: October 16, 2011, 04:58:59 pm by jalama »
http://www.rootyhollow.com

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: CiviEvents: Display "Defaults" has an invalid style plugin.
October 17, 2011, 08:37:13 am
I just realized I forgot to mention pay particular attention to funky time zones, that has always been an issue with CiviCRM/Drupal integration
http://www.rootyhollow.com

johndieter

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
  • CiviCRM version: 4.1 beta 2
  • CMS version: drupal 7.10
  • MySQL version: 5
  • PHP version: 5
Re: CiviEvents: Display "Defaults" has an invalid style plugin.
January 16, 2012, 09:05:29 am
how do you run a patch? how do you apply a patch?
Can I just upgrade to a newer version to get something that already has these patches applied?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • CiviEvents: Display "Defaults" has an invalid style plugin.

This forum was archived on 2017-11-26.