I am using automodal successfully for pages, and Images, but I would like to customize the width and height of the window so my image can be displayed in full size, I would be nice to just add this on the class....

Comments

tpainton’s picture

You can use a custom size window using automodal_add() and set the width option.

<?php
automodal_add('.myselector', array('width' => 700));
?>
zdean’s picture

Where would this code go? I tried in the template.php and page.tpl.php and had no effect from either.

Thanks in advance.

feuillet’s picture

Would like to know that too, the documentation doesn't cover that.

bshensky’s picture

I can understand that the automodal_add() should be specified in a custom hook prior to the form or page render (I'm looking at you, hook_form_alter() and hook_view()), but I don't know what I'm /selecting/. What is .myselector?

giorgosk’s picture

Status: Active » Fixed

create custom module in my example alterations is the module name

alterations.info file

name = Custom alteration
description = Custom alterations
package = Alterations
core = 6.x

alterations.module file

<?php
// $Id$

function alterations_automodal_alter(&$settings, $selector) {
  if ($selector == '.automodal') {
    $settings['width'] = 380;
    $settings['height'] = 190;    
  }
}

put files in sites/all/modules/alterations folder
and go in admin/build/modules
and enable it

can change following variables

* - autoFit: Whether the window should automatically fit to the window.
* Defautlts to TRUE.
* - draggable: If the dialog is draggable. Defaults to True.
* - width: The width of the dialog in px. Defaults to 600.
* - height: The heigh of the dialog in px. Defaults to 400.
* - automodalClose: On form submissions close the modal window. Default True.
* - automodalReload: Reload the page on form submission. Depends on automodalClose
* set to TRUE. Defaults to FALSE.
* - automodalRedirect: Redirect to a new location. Depends on automodalClose
* being set to TRUE. This should be a fully qualified url.

capellic’s picture

Category: support » task

The solution in #5 is great if you want to override the existing selector, but if you want a new one, you should add it to your template.php. I don't know why @zdean in #2 had that problem. It also works in the tpl file.

Would be nice if they made it clear that this is a themeing function in the documentation and at the top of the automodal_add() function description in automodal.module.

Thanks for this GREAT module!

Status: Fixed » Closed (fixed)

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

ehalber’s picture

I was having the save issues as #2 @zdean. This is what I did to fix it.

I placed the automodal_add() function in my theme's template.php file. The trick is to change the class name. The default install uses 'automodal'. Once you change this you're golden.

automodal_add('.make-modal', array(
    'autoFit' => false
    ,'width'   => 500
    ,'height'  => 630)
);

Works like a charm now :-) Hope this is helpful to and noobs out there.

modctek’s picture

For the life of me, I cannot get any of this to work except building the custom module to override the default "automodal" class selector. I need to add multiple window sizes, but cannot seem to get anything except "automodal" to work. Can someone explain in painful newbie detail how to add either function mentioned above to template.php?

modctek’s picture

OK, I knew if I posted I would soon-after stumble upon the solution all by myself. For me (your mileage may vary), I need to add the following code to my template.php file above the functions.

automodal_add('.customselector', array('width' => 650, 'height' => 290));
automodal_add('.customselector2', array('width' => 480, 'height' => 480));
modctek’s picture

Something else to note: if you are using modalframe-exclude as one of your class selectors (eg. going from modal to modal), your custom class selectors will not work.

I don't know how to fix this, as the URL arguments "height" and "width" nor "autoFit" do not work.

serguitus’s picture

Solution in #5 worked very well for me.
1 thing to note, it didn´t resize to my specified width until I added
$settings['autoFit'] = False;
it was just a Note :)
thanks for the great automodal!

PD: I steel think that it would be better for themers if you just add css classes with js and edit things in css file. I will look arround to see if this is possible and if I´m lucky, I will post here