Acidfree breaks my fixed-width layout when I click on the "album contents" tab. It looks like the trouble is the table Acidfree generates on those pages--it creates a three-column table with album thumbnail, thumbnail pulldown menu and title/description/path alias cells. The width of this unflexible table kills my tableless layout big-time.

I can't see any way around removing the table in favor of a CSS approach, but I'm having trouble locating in the Acidfree module code where the table is created.

Ideally I wouldn't have to modify the Acidfree module at all, but I figure there's no way around that.

Any help would be greatly appreciated. Thanks!

-Peter

Comments

vhmauery’s picture

All of acidfree's drawing routines are themable so it is easy enough to write your own theme method for it. (well, I admit the the 4.6 version might be a little harder to do that, but the 4.7 one uses theme_acidfree_album_contents to draw).

Happy hacking. Though technically, it's not hacking if you are simply writing your own theme.

kowalke’s picture

Vernon,

After your response, I spent all day learning how to modify a function from within template.php. I still don't see how I can do it with 4.6, though. You said it might be harder, so I'm guessing you have an idea how it can be done. Can you give me a little direction here, because I'm not seeing it at all.

Thanks so much.

-Peter

--
http://www.grownwithoutschooling.com

pembeci’s picture

For 4.6 the function is acidfree_album_contents. For a quick and dirty fix you may try changing the length of these form elements in that function and see if it helps:

$title = form_textfield(t("Title"), "{$child->nid}][title", $child->title, 50, 128);
$title .= form_textarea(t('Description'), "{$child->nid}][body", $child->body, 59, 2, null);

For 4.7 (your post is tagged as 4.6 but there is no pulldown menu in 4.6), the function is _acidfree_album_contents_form which has a lot of new Forms API code naturally. I also suggest writing your own theme function, it is always better than hacking module code.

Good luck.

kowalke’s picture

Working on a 4.6 installation, I'm trying to tweak the acidfree_album_contents function. I obviously don't yet understand how theming functions works, however, for I'm having no luck changing the function.

What I THINK I need to do is throw this in my template.php file in my theme, then make a file called acidfree_album_contents.tpl.php with the new version of the function, also putting that in my theme's folder:

function phptemplate_acidfree_album_contents($node) {
	return _phptemplate_callback('acidfree_album_contents', array('node' => $node));
}
pembeci’s picture

I don't have the code in front of me but I think acidfree_album_contents is not themable by default in 4.6.
So you have to directly change that function in the module file. You can try to make it themable but it will also mean changing the module code so it may be just easier to change the function itself.

kowalke’s picture

Thanks. I had all but come to that conclusion myself at this point, but it is nice to have confirmation that I"m not missing something.

Drats. I guess this is another reason to upgrade to 4.7--I just hope all the mods I need are ported over soon so I can make the upgrade.

-Peter

--
http://www.grownwithoutschooling.com

kowalke’s picture

Thanks for the help; I really appreciate it.

I guess it is time to learn how to use themable functions, as I'd definitely rather theme than hack a mod.

Has anyone modified the acidfree_album_contents function to solve a similar problem? I can't image I'm the only person who uses Acidfree and has a fixed-width site.

-Peter

--
http://www.grownwithoutschooling.com

n1nja’s picture

Hi,

I've just noticed this for my site too.
The "menu" and "urlpath" settings are on the right of the textarea, instead of underneath.

I'm going to see if any of the above suggestions help.

except I'm using 4.7, so it should be easier

virgo’s picture

This problem can be fixed by themable function - just copy album content function from acidfree.module to new template.

I am using Drupal 4.7.

Put following lines to template.php -

function phptemplate_acidfree_album_contents($form) 
{
return _phptemplate_callback('acidfree_album_contents', array('form' => $form));
}

create new file called acidfree_album_contents.tpl.php and copy following to that file

<?php 
    if (count($form['nodes']) == 0)
        return "Album on tühi <br>";
    $output .= form_render($form['pager']);
    $output .= '<div class="container-inline" style="padding: 5px;">';
    foreach (element_children($form['actionstop']) as $key) {
        $output .= form_render($form['actionstop'][$key]) . '&nbsp;&nbsp;';
    }
    $output .= '</div>';

    foreach (element_children($form['nodes']) as $child) {
        $row[] = Array('data' => form_render($form['nodes'][$child]['checked']));
        $cell = form_render($form['nodes'][$child]['preview']);
        foreach (array_keys(acidfree_form_elements($form['nodes'][$child])) as $key) {
            $cell .= form_render($form['nodes'][$child][$key]);
        }
        $row[] = Array( 'data' => $cell,
                'class' => 'album-cell');
        $cell = '';
        $cell = form_render($form['nodes'][$child]['title']);
        $cell .= form_render($form['nodes'][$child]['body']);
        $cell .= form_render($form['nodes'][$child]['parent']);
        $cell .= form_render($form['nodes'][$child]['weight']);
        $row[] = Array('data' => $cell, 'class' => 'album-cell');
        $cell = form_render($form['nodes'][$child]);
        $row[] = Array('data' => $cell, 'class' => 'album-cell');
        $rows[] = Array('data' => $row);
        unset($row);
    }
    $output .= theme('table', NULL, $rows);
    $output .= '<div class="container-inline" style="padding: 5px;">';
    foreach (element_children($form['actionsbot']) as $key) {
        $output .= form_render($form['actionsbot'][$key]) . '&nbsp;&nbsp;';
    }
    $output .= '</div>';
//    $output .= '<code>'; $output .= dump($form); $output .= '

';
return $output.form_render($form);
?>
This is actual lines from acidfree.module and after that everything was ok in my case. And now you can change everything without hacking module itself.

Although I am not sure whether I did it all correctly - not that good in php

n1nja’s picture

thanks for the help
i'll try it out.

166533’s picture

Thank you so much for posting that solution. I was tearing my hair out over this and it works perfectly now.

virgo’s picture

Give me comments - did it wotk for you ot not ?

166533’s picture

Yes, it worked absolutely perfectly. Thank you.