Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hallo,
$text = 'link';
$entity_id = [file:fid];
$link = modal_entities_generate_link($text, 'file', $entity_id, $view_mode = 'preview', $style = 'large');
print render($link);
with this code the link is rendered correctly
<a href="/modal-entities/nojs/file/2467/preview" class="ctools-use-modal ctools-modal-modal-entities-large ctools-use-modal-processed" title="link">link</a>
but the result is always the same, full content view mode and medium modal.
Also, how can I add a class to the link? I d like to be able to change some settings in modal with
drupal_add_js(array(
'my-modal-style' => array(
'modalSize' => array(
'type' => 'fixed',
'width' => 250,
'height' => 250,
),
),
), 'setting');
but I need at least to add a class to the link
tx
Simone
Comments
Comment #1
a.milkovskySounds like a bug. View mode should be used in entity_view($entity_type, array($entity), $view_mode); inside of _modal_entities_popup(). I will have a look. (Hopefully today).
Currently the module is not flexible enough for custom settings. But I am open to the ideas. If you have a working patch I would commit it with a pleasure.
I was thinking about a new hook_model_entities_style_info(), where you can provide own style with settings. Like:
Comment #2
cimo75 CreditAttribution: cimo75 commentedHi,
it seems like the options from the .module file are not used at all. I tried to change them there but nothing changes in the modal.
S.
Comment #4
a.milkovskyFixed in new release. Please check now. Also added hook_modal_entities_style_info()
Comment #5
cimo75 CreditAttribution: cimo75 commentedThanks for looking into this.
Now it is possible to choose the view mode for the modal (great!), but it is not possible to change the style, it seems like it always defaults to small.
Deleting compeltely the function
function modal_entities_modal_entities_style_info()
in your code makes it use the "large" style (which is what I want.).
Simone
Comment #6
a.milkovskyIf you need the 'large' style simply use:
Default is 'middle'. Could you provide your code?
Comment #7
cimo75 CreditAttribution: cimo75 commentedOk that works I was a bit confused about the proper syntax.
Tx
Simone
Comment #8
a.milkovskywelcome