i am new to drupal theming.
i want to do the following:
i have a product content type that i am manipulating it's node-product.tpl.php,
the product content-type has a CCK field of type "Embedded Video" (using the Media module found at http://drupal.org/project/media ).
since i need to wrap the "Embedded Video" field with a

    tag i want to add to my node-product.tpl.php code that looks like these:
    • print theme(...)

    i found in sites/all/modules/cck/content-module file the following function:
    "function content_theme() {
    $path = drupal_get_path('module', 'content') .'/theme';
    require_once "./$path/theme.inc";

    return array(
    'content_field' => array(
    'template' => 'content-field',
    'arguments' => array('element' => NULL),
    'path' => $path,
    )," ...
    from that code i assume that i my code should be:

    • print theme('content_field', $element)


    couple of questions:
    1. am i on the right track ? should i use the theme function, am i am calling the right cck hook theme ?
    2. assuming that i am correct, i cant tell what is the $element parameter should be, on my node-product.tpl.php i have the $node parameters that has a lot of data in it, how can i get from the $node parameter the correct $element that should be sent to the theme(...) function ?
    3. is there a batter way to find out about each module registered theme hooks name and the parameters they expect to get than browsing the module's code ?

    thanks for reading my long question, help will be appreciated.


rbriskie’s picture

Usually you print cck fields like this, replacing 'FIELDNAME' with your cck field's name.

<?php print $node->field_FIELDNAME[0]['view']; ?>

So to wrap it in your own tag you could do something like this:

<div id="video">
<?php print $node->field_FIELDNAME[0]['view']; ?>