по умолчанию Image выводит картинку с весом 0. а вот потребовался вывод картинки (Image) ниже описания (body) в полной версии и после картинки в короткой (teaser)??? Это не есть хорошо. Поэтому в рабочем порядке сделано было так
:
vaulter@vaulter-desktop:~/www/dr.localhost/sites/all/modules/image$ diff -u ../../../default/modules/image/image.module image.module
--- ../../../default/modules/image/image.module 2007-09-29 09:19:40.000000000 +0400
+++ image.module 2008-03-19 03:23:49.000000000 +0300
@@ -104,7 +104,18 @@
'#size' => 12,
'#description' => t('Maximum file size for image uploads. When a maximum image dimensions is specified for original images the size is checked after resizing. '),
);
-
+ $form['image_weight_teaser'] = array(
+ '#type' => 'weight',
+ '#title' => t('Teaser image weight'),
+ '#default_value' => variable_get('image_weight_teaser', 0),
+ '#description' => t("This value determines the order of the image when displayed in the teaser."),
+ );
+ $form['image_weight_body'] = array(
+ '#type' => 'weight',
+ '#title' => t('Full node image weight'),
+ '#default_value' => variable_get('image_weight_body', 0),
+ '#description' => t("This value determines the order of the image when displayed in the body."),
+ );
$form['image_sizes'] = array(
'#type' => 'fieldset',
'#title' => t('Image sizes'),
@@ -579,7 +590,7 @@
$node = node_prepare($node, $teaser);
$node->content['image'] = array(
'#value' => theme($teaser ? 'image_teaser' : 'image_body', $node, $size),
- '#weight' => 0,
+ '#weight' => variable_get( $teaser? 'image_weight_teaser': 'image_weight_body', 0)
);
return $node;
}вуаля! мы можем настроить вывод картинки от Image по весу.
А если нам, скажем, потребуется прикрепить еще картинку к уже документу Image!?
Настройки то есть, но они доступны только для документов других типов, а самого для типа Image нет!!!!
Срочно исправляем это положение вещей:
vaulter@vaulter-desktop:~/www/dr.localhost$ diff sites/default/modules/image/contrib/image_attach/image_attach.module sites/all/modules/image/contrib/image_attach/image_attach.module -u
--- sites/default/modules/image/contrib/image_attach/image_attach.module 2007-10-10 08:57:58.000000000 +0400
+++ sites/all/modules/image/contrib/image_attach/image_attach.module 2008-03-18 23:54:40.000000000 +0300
@@ -64,7 +64,7 @@
*/
function image_attach_form_alter($form_id, &$form) {
// Content type settings form.
- if ($form_id == 'node_type_form' && $form['#node_type']->type != 'image') {
+ if ($form_id == 'node_type_form' /*&& $form['#node_type']->type != 'image'*/) {
_image_check_settings();
$image_sizes = array(IMAGE_ATTACH_HIDDEN => t('<Hidden>'));И получаем необходимые настройки. Напоследок скажу лишь, что не проверял что будет если для Image включить поддержку Image attach, но наверника что-то интересное :)
| Вложение | Размер |
|---|---|
| image_attach.patch.gz | 349 байтов |
| image_weight.patch.gz | 657 байтов |