Projet

Général

Profil

Révision 5d12d676

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/modules/system/views_handler_field_file_filemime.inc
6 6
 */
7 7

  
8 8
/**
9
 * Field handler to add rendering MIME type images as an option on the filemime field.
9
 * Add rendering MIME type images as an option on the 'filemime' field.
10 10
 *
11 11
 * @ingroup views_field_handlers
12 12
 */
13 13
class views_handler_field_file_filemime extends views_handler_field_file {
14
  function option_definition() {
14

  
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function option_definition() {
15 19
    $options = parent::option_definition();
16 20
    $options['filemime_image'] = array('default' => FALSE, 'bool' => TRUE);
17 21
    return $options;
18 22
  }
19 23

  
20
  function options_form(&$form, &$form_state) {
24
  /**
25
   * {@inheritdoc}
26
   */
27
  public function options_form(&$form, &$form_state) {
21 28
    $form['filemime_image'] = array(
22 29
      '#title' => t('Display an icon representing the file type, instead of the MIME text (such as "image/jpeg")'),
23 30
      '#type' => 'checkbox',
......
26 33
    parent::options_form($form, $form_state);
27 34
  }
28 35

  
29
  function render($values) {
36
    /**
37
     * {@inheritdoc}
38
     */
39
  public function render($values) {
30 40
    $data = $values->{$this->field_alias};
31 41
    if (!empty($this->options['filemime_image']) && $data !== NULL && $data !== '') {
32 42
      $fake_file = (object) array('filemime' => $data);
......
35 45

  
36 46
    return $this->render_link($data, $values);
37 47
  }
48

  
38 49
}

Formats disponibles : Unified diff