I'm using Views 2.12, I don't know if this is specific to my version or if it is something more general.

I tried to export a custom view using the Views Exporter. It gave me the code to copy/paste into foo.info foo.module and foo.views_default.inc but the module didn't work.

It took me a while to find the problem (I'm no coder...) and I fixed it by adding the starting <?php tag in the begging of foo.module and foo.views_default.inc

So now I have

<?php
/**
 * Implementation of hook_views_api().
 */
function foo_views_views_api() {

and

<?php
/**
 * Implementation of hook_views_default_views().
 */
function foo_views_views_default_views() {

I suggest that the exporter adds these by default, so that the resulting code is ready to run once pasted into the module files.

Comments

bserem’s picture

I tried to make a patch for what I'm describing.
Hope it works, and hope it is "ok code"!

ps: It wasn't done by cloning views locally since git clone only gets me a ".git" folder and nothing else

dawehner’s picture

Version: 6.x-2.12 » 6.x-3.x-dev
Category: bug » feature

This sounds for my like a valid feature request, even this will probably not be commited to 6.x-2.x because it's in a critical bug fix only mode and all new things get's commited to 6.x-3.x.

In general you could fill an issue against ctools as well which has also a bulk exporter.

bserem’s picture

You are correct! I don't know if my patch is suitable for 6.x-3.x-dev, haven't tried it there! I'll give a try sometime soon!

As for ctools, I'm not well acquainted with them (yet). I've used the exporter without problems though. Only views_exporter had this problem.

dawehner’s picture

Status: Active » Fixed

Thanks for the patch commited to 6.x-3.x

Status: Fixed » Closed (fixed)

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