Really the only thing stopping you from using enabling galleria on any custom node is the placement. Letting you determine placement via CCK weights handles this, and you can drag the gallery to wherever you want.

The following code is from the local version I'm working with, and could use a little refinement. Specifically, this only works if the content type is "galleria" and this could be fixed in some way by doing a lookup on node settings and seeing if it has galleria enabled, but I'm not sure how to accomplish that yet.

In galleria_nodeapi:

unset($node->content['files']);
$node->content['galleria']['#value'] = theme('galleria', $node);
$node->content['galleria']['#weight'] = content_extra_field_weight($node->type, "galleria");
break;

Then add this function:

/**
* Implements hook_content_extra_fields()
*
* CCK hook to allow sorting of the gallery display.
*/
function galleria_content_extra_fields($type_name = NULL) {
  if (!empty($type_name) && $type_name == "galleria") {
    return array(
      'galleria' => array(
        'label' => t('Gallery'),
        'description' => t('Display of the selected images in gallery format.'),
//        'weight' => 1, //not sure if this is important
      ),
    );
  }
}

Also, this is a possible solution to http://drupal.org/node/347715 (using with arbitrary node types).

Slightly unrelated, but I also had to use this in my theme's template.php file preprocess override in order to hide the file listing. There may be better ways to do that as well.

unset($vars['node']->files);

Comments

Mark Theunissen’s picture

You can get rid of the file list by unchecking "list" next to the files on the node edit page. You can also make all files unlisted by default in the upload module settings.

Thanks for the code. I will definitely incorporate it so that the proper weighting can be adjusted. I've been hoping to move to imagefield / filefield when they're ready too, which will solve many issues.

#347715: Embedding a Galleria into a node (page/blog/story)? is slightly different, the creator of that issue wants an input format for inserting Gallerias between paragraphs of text. But maybe this solution will help them.

Will update when I've made progress.

avolve’s picture

I was looking at posting about support for imagefield/filefield. I look forward to testing it when ready (and when these modules come out of alpha/beta as well).

Mark Theunissen’s picture

Thanks for the code, I've implemented the changes and it's working - you can adjust weight in the CCK settings.

FYI To check if a node type is selected as a Galleria, use the following variable check:


variable_get("galleria_$type_name", 0) == 1

Mark Theunissen’s picture

Status: Active » Fixed

Fixed in Beta-2

Status: Fixed » Closed (fixed)

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