[development] minimizing views_default_views in a module

Carl Wiedemann carl.wiedemann at gmail.com
Fri Mar 18 15:08:50 UTC 2011


Considering the maintenance of this is at minimum typing "drush
features-update foo" and at maximum copying/pasting some code, it seems
relatively minor. Views export/import expects these parameters, so I don't
recommend changing them.

Specific questions/issues like this are better suited for the Views issue
queue, but I don't think this particular question has much traction. It's
not a bug, nor affects performance (especially not with an opcode cache).
It's a question of personal preference and semantics, some of which you may
have to abandon when leveraging Drupal. ;)


On Fri, Mar 18, 2011 at 9:54 AM, Sean Dague <sean at dague.net> wrote:

> For instance, I find large duplication of:
>
>        'alter' => array(
>          'alter_text' => 0,
>          'text' => '',
>          'make_link' => 0,
>          'path' => '',
>          'link_class' => '',
>          'alt' => '',
>          'prefix' => '',
>          'suffix' => '',
>          'target' => '',
>          'help' => '',
>          'trim' => 0,
>          'max_length' => '',
>          'word_boundary' => 1,
>          'ellipsis' => 1,
>          'html' => 0,
>          'strip_tags' => 0,
>        ),
>
> all throughout the export to be not conducive to maintainability (there are
> 12 instances of that stanza, 9 are exactly the same, and the other 3 only
> vary in their 'text' field).
>
> I find that level of duplication somewhat problematic, and something I like
> to avoid.
>
>        -Sean
>
>
> On 03/18/2011 09:31 AM, Carl Wiedemann wrote:
>
>> Not quite sure I understand what exactly is non-maintainable?
>>
>> You may also investigate http://drupal.org/project/features for
>> assistance with exporting Views to code.
>>
>>
>> On Fri, Mar 18, 2011 at 7:45 AM, Sean Dague <sean at dague.net
>> <mailto:sean at dague.net>> wrote:
>>
>>    I'm working on a new drupal 6.x module (currently in sandbox
>>    awaiting review - http://drupal.org/sandbox/sdague/1072704) which
>>    exports it's data via views.  When I implemented
>>    hook_views_default_views() I just used the export functionality on
>>    views for a few basic views to get things started.
>>
>>    That works, but those are both very verbose, and don't implement any
>>    i18n. Is there a standard way of trimming down the default values in
>>    those views so this becomes a bit more sane and maintainable?
>>
>>    Advice would be appreciated,
>>
>>            -Sean
>>
>>    --
>>
>>    Sean Dague                       Learn about the Universe with the
>>    sean at dague dot net          Mid-Hudson Astronomical Association
>>    http://dague.net http://midhudsonastro.org
>>
>>
>>
>
> --
>
> Sean Dague                       Learn about the Universe with the
> sean at dague dot net          Mid-Hudson Astronomical Association
> http://dague.net                         http://midhudsonastro.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110318/4e6b6dcf/attachment.html 


More information about the development mailing list