Comments

alzz created an issue. See original summary.

alzz’s picture

Status: Active » Needs review
StatusFileSize
new8.71 KB

Here is a first attemp to port the carousel plugin to D8.
Im setting the carousel html id with the $view->dom_id, we have to figure out the best approach for ids for all the plugins.

kevla’s picture

Patch seems to work for me.

Getting a notice though:

Error messageNotice: Undefined index: default in Drupal\views\Plugin\views\PluginBase->setOptionDefaults() (line 182 of core/modules/views/src/Plugin/views/PluginBase.php).

dobe’s picture

StatusFileSize
new8.91 KB

All worked fine for me. I did change the way we get the id in this patch. It is more in line with D7 way of doing it. May not be the right way to get it done though.

dobe’s picture

trevjs’s picture

I couldn't get it to work as is, but it seems to work after I made some changes.

In the theme.inc file the preprocess function is 'template_preprocess_views_bootstrap_carousel' but in your theme registry alter function you use 'template_preprocess_views_view_carousel'.

I also moved the theme path and include path out of the default case as those won't get included now that you added the breaks. Is the switch case even necessary?

trevjs’s picture

Status: Needs review » Needs work

See comments above.

dobe’s picture

Yeah I agree. That whole switch statement in the views_bootstrap.module I think needs to go entirely (I was planning on making a separate issue for that. Then updating all the port issues to reflect that change. We could just use the code from the "default" in the switch which does exactly what needs to be done.

In addition to that. I found it difficult to override the twig file within my theme. Because we are coding the "path" in that switch statement. However without it. Drupal cannot find the file. So I think there is an issue with that implementation. I had to add the theme registry alter to my own theme as I don't use the glyphicons I wanted to use the fontawesome instead. So there are definitely issues here related to these things.

I am just trying to do a quick over view port of all the different styles and row plugins. Then I will look the right way of implementing that theme registry override.

jorisdrupal’s picture

When I put the
views-bootstrap-carousel.html.twig
in
themes/MYTHEME/templates/views/
I can override the template.

but the twig debug hinter does not suggest this.

jorisdrupal’s picture

StatusFileSize
new9.38 KB

Here is a working patch,
and you can override as stated above.

hswong3i’s picture

Status: Needs work » Reviewed & tested by the community

Confirm patch from #10 works well ;-)

firfin’s picture

Appleis to dev and works like a charm, RTBC indeed.

ponies’s picture

Likewise. #10 applied and got me sliding again.

Metal3d’s picture

Patch applied also, and it works like a charm.

stephen ollman’s picture

OUTSTANDING!

jmr3460’s picture

Where does this patch need to be inserted? What file?
OK looking at the patch I believe it is telling me that the file I am dealing with is 'src/Plugin/views/style/ViewsBootstrapCarousel.php' I am looking in the bootstrap folder and I do not have this file. Can someone let me know where this file is Please?

stephen ollman’s picture

You need to create:

- a new file called 'ViewsBootstrapCarousel.php' in a folder at /modules/views_bootstrap/src/Plugin/views/style
- a new folder called 'views_bootstrap_crousel' in a folder at /modules/views_bootstrap/templates
- a new file called 'theme.inc' in the folder at /modules/views_bootstrap/templates/views_bootstrap_crousel
- a new file called 'views-bootstrap-carousel.html.twig' in the folder at /modules/views_bootstrap/templates/views_bootstrap_crousel

From the patch file you'll find the relevant code parts for each of the 3 files you need to create.

Hope that helps.

tunic’s picture

To 'insert' the patch you just need to copy the patch file to the module root directory and execute:

patch -p1 < port_carousel_plugin_to-2720791-5.patch

Given that the path file is port_carousel_plugin_to-2720791-5.patch.

You can get more info at https://www.drupal.org/patch/apply

jmr3460’s picture

Thanks for reply. So with the directions above I am creating empty files and folders and the patch will insert the code, yes?

tunic’s picture

No, you don't have to create any file or directory. The patch program should do it for you, because all information needed is in the patch.

I don't know why #17 suggests to do it manually, but it's not the way to do it because the 'patch' program takes care of the process.

stephen ollman’s picture

Just helping those that may not be able to update a module using the standard patch method.

Obviously if you know how to patch correctly than the patch command is the way to go.

tunic’s picture

Then I understand it Stephen. IMHO I'd say it's worth to mention the 'path' way along wih the manual patch applying, just in case user can use that way (usually user just don't know the program).

jmr3460, if you don0t have 'patch' executable you ca use 'git apply'.

platinum1’s picture

The patch has been RTBC for some time. Is there a reason why the patch is not being applied in a new build?

jmr3460’s picture

Ok Thanks for the help. The patch did create the files and folders it looks like. Now I am off the attempt to create a carousel.

Ok I checked and everything seems to work. You guys have helped my a lot.

  • mrded committed 73617b8 on 8.x-3.x
    Issue #2720791 by alzz, dobe, jorisdrupal: Port carousel plugin to D8
    
mrded’s picture

Issue summary: View changes
mrded’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Thank you guys for working on this! Committed to 8.x-3.x branch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.