Имя:    Пароль:      Помнить меня       
Unsorted   ~  Software  ~  Development and Design  ~  Drupal Content Management System
Syooo
Сообщение  26 Дек 2010, 21:46  Ссылка : Ответить с цитатой
Возраст: 32 Пол: Мужской 
C нами с 10.06.2007
Репутация: 90.1

Тема про жумлу есть, а про друпал что то нету. Предлагаю тут обсуждать всякие вопросы связанные с друпалом.

Вот у меня вопрос, который меня давно интересует. Кто как делает шапки?
Делаете блок, который выводится в хедер регион, или же напрямую зашиваете в темплейт? Стыдно

+ Вчера надо было переписать стандартный модуль Upload (дада, знаю что так не делается, но не знаю как написать модуль, который будет изменять функицю стандартного модуля), добавить дополнительное поле для описания. Кто нить знает как с помощью formapi переместить форму под поле названия, как на картинке?

Код отрисовки формы таков:
function theme_upload_form_current($form) {
  $header = array('', t('Delete'), t('List'), t('Name'), t('Description'), t('Weight'), t('Size'));
  drupal_add_tabledrag('upload-attachments', 'order', 'sibling', 'upload-weight');

  foreach (element_children($form) as $key) {
    // Add class to group weight fields for drag and drop.
    $form[$key]['weight']['#attributes']['class'] = 'upload-weight';

    $row = array('');
    $row[] = drupal_render($form[$key]['remove']);
    $row[] = drupal_render($form[$key]['list']);
    $row[] = drupal_render($form[$key]['description']);
    $row[] = drupal_render($form[$key]['comment']);
    $row[] = drupal_render($form[$key]['weight']);
    $row[] = drupal_render($form[$key]['size']);
    $rows[] = array('data' => $row, 'class' => 'draggable');
  }
  $output = theme('table', $header, $rows, array('id' => 'upload-attachments'));
  $output .= drupal_render($form);
  return $output;
}

Формы такие:
    foreach ($node->files as $key => $file) {
      $file = (object)$file;
      $description = file_create_url($file->filepath);
      $description = "<small>". check_plain($description) ."</small>";
      $form['files'][$key]['description'] = array('#type' => 'textfield', '#default_value' => !empty($file->description) ? $file->description : $file->filename, '#maxlength' => 256, '#description' => $description );
      // hack
      $form['files'][$key]['comment'] = array('#type' => 'textarea', '#rows' => 2, '#default_value' => $file->comment);
      // hack
      $form['files'][$key]['size'] = array('#value' => format_size($file->filesize));
      $form['files'][$key]['remove'] = array('#type' => 'checkbox', '#default_value' => !empty($file->remove));
      $form['files'][$key]['list'] = array('#type' => 'checkbox',  '#default_value' => $file->list);
      $form['files'][$key]['weight'] = array('#type' => 'weight', '#delta' => count($node->files), '#default_value' => $file->weight);
      $form['files'][$key]['filename'] = array('#type' => 'value',  '#value' => $file->filename);
      $form['files'][$key]['filepath'] = array('#type' => 'value',  '#value' => $file->filepath);
      $form['files'][$key]['filemime'] = array('#type' => 'value',  '#value' => $file->filemime);
      $form['files'][$key]['filesize'] = array('#type' => 'value',  '#value' => $file->filesize);
      $form['files'][$key]['fid'] = array('#type' => 'value',  '#value' => $file->fid);
      $form['files'][$key]['new'] = array('#type' => 'value', '#value' => FALSE);
    }





1.png

1.png - Просмотров: 24

В начало
Профиль : Фотоальбом : Личное Сообщение : ICQ
Показать сообщения:   

Unsorted   ~  Software  ~  Development and Design  ~  Drupal

Ответить на тему

Перейти:  





Powered by phpBB   © Unsorted Team  support@unsorted.me  promo@unsorted.me  Полезные скрипты