【问题标题】:how to create a title document file and type of document file in drupal 8如何在 drupal 8 中创建标题文档文件和文档文件类型
【发布时间】:2022-01-05 01:24:25
【问题描述】:

如何创建文件来捕获文档文件的类型

drupal 8 中文档文件的标题。

【问题讨论】:

    标签: templates view drupal field title


    【解决方案1】:

    为媒体创建一个字段(例如类型文档):

    /admin/structure/media/manage/document/fields

    用这个预处理字段 (how do I call my theme preprocess function for a specific field?):

    $fileinfos = File::load($fileId);
    $filetype = $fileinfos->getMimeType();
    /* $filesize = format_size($fileinfos->getSize()); */
    

    变量 $filetype 是 MIME 类型,用于保存字段中的值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-20
      • 2011-01-27
      • 1970-01-01
      • 2020-05-27
      • 1970-01-01
      相关资源
      最近更新 更多