New users of the Dynamic display block module have mainly problems to get the Advanced options of the module working because of the amount of steps they have to do to get the module working. A lot of steps means also a lot can go wrong and not all users are programmers using php code daily to make e.g. changes in preprocess functions.

In a future version of the Dynamic display block module we want to create a ready made slideshow when the dynamic display block module is installed to make it easier for new users to use the module.

The flexibility of the module using your own content types and views would stay.

Creating a ready to use slideshow when the module is installed means:

  1. Creating a content type programatically
  2. Creating a view programmatically
  3. Move the necessary preprocess functions for the content type and view to the module preprocess functions

For creating the content type, e.g. choices have to be made: use imagefield module or Image module or IMCE for the image. Or maybe make a content type for each option. Only create the content type if the required modules are installed, etc.

Who wants to help making this possible in a future release of the dynamic display block module or has any suggestions how to realize this.

thanks,

Philip Blaauw and Iren Biasong
Module maintainers

Comments

ppblaauw’s picture

Found some more info how to create cck content types and views programmaticaly:

1.) Create Content Types

Export the content type from CCK (admin/content/types/export), save the array in an array, and then pass it to the function below. This improves upon the previously known techniques, in that the exported CCK types no longer need to be escaped.

function _install_create_content($content, $type_name = '<create>') {
  $type = $content['type']['type'];
  global $_install_macro;
  $_install_macro[$type] = $content;
  include_once './'. drupal_get_path('module', 'node') .'/content_types.inc';
  include_once('./'. drupal_get_path('module', 'content') .'/content_admin.inc');
  $macro = 'global $_install_macro; 
  $content = $_install_macro['. $type .'];';
  $form_state = array('values' => array('type_name' => $type_name, 'macro' => $macro));
  drupal_execute('content_copy_import_form', $form_state);
  content_clear_type_cache();
}

Is this the way to go?

2.) Create view

hook_views_default_views( )
This hook allows modules to provide their own views which can either be used as-is or as a "starter" for users to build from.

This hook should be placed in MODULENAME.views_default.inc and it will be auto-loaded. This must either be in the same directory as the .module file or in a subdirectory named 'includes'.

The $view->disabled boolean flag indicates whether the View should be enabled or disabled by default.

Returns:
An associative array containing the structures of views, as generated from the Export tab, keyed by the view name. A best practice is to go through and add t() to all title and label strings, with the exception of menu strings.

Is this the way to go?

3.) Move preprocess functions

No problem here I think when cck and view are there

4.) Creating example nodes

Maybe also nice to create example nodes. So how to programmatically create CCK example nodes is the next to find out.

Keep you all posted.
Any help to get this implemented appreciated.