d8-contrib-modules / views_slideshow

D8 port of Views Slideshow, owned by Vincent
0 stars 1 forks source link

Update SlideshowSkin to ViewsSlideshowSkin + update theme preprocess to use new Skin mechanism #3

Closed vbouchet31 closed 9 years ago

vbouchet31 commented 9 years ago

There is an issue in .theme.inc as

$skin = $skinManager->createInstance($options['slideshow_skin']);

throw an exception due to a missing class.

“Plugin (default) instance class “Drupal\views_slideshow\Plugin\SlideshowSkin\DefaultSkin” does not exist.”

vbouchet31 commented 9 years ago

Fixed: Mistake in namespace definiton. (facepalm)

To reproduce the issue:

In views_slideshow.theme.inc, _views_slideshow_preprocess_views_view_slideshow() is the function defined by the Views style plugin to render it. Around the line 100, we try to access the skin attribute by using ->getClass() and ->getLibraries().

$skinManager = \Drupal::service('plugin.manager.views_slideshow.slideshow_skin');
$skin = $skinManager->createInstance($options['slideshow_skin']);

get a blank page with

An error occured, blablabla and throw in logs Drupal\Component\Plugin\Exception\PluginException: Plugin (default) instance class "Drupal\views_slideshow\Plugin\ViewsSlideshowSkin\DefaultSkin" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 87 of /Users/vincent.bouchet/Sites/devdesktop/d8b14/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).

If I try to use the getDefintion:

$skinManager = \Drupal::service('plugin.manager.views_slideshow.slideshow_skin');
$skin = $skinManager->getDefinition($options['slideshow_skin']);
dsm($skin->getClass());

get a blank page with

Fatal error: Call to a member function getClass() on a non-object in /Users/vincent.bouchet/Sites/devdesktop/d8b14/modules/contrib/views_slideshow/views_slideshow.theme.inc on line 102