📜  drupal 9 自定义本地流包装器 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:49.389000             🧑  作者: Mango

代码示例1
This is a modified snippet from a live real estate project to define a custom stream wrapper.

Add the stream wrapper as a service in your services YML file:

    stream_wrapper.pics:
      class: Drupal\mymod\PicsStreamWrapper
      tags:
        - { name: stream, scheme: pics }



Create the stream wrapper class extending LocalStream:

    getTarget());

            return $base_url . '/' . self::getDirectoryPath() . '/' . $path;
        }

        public function getName() {
            return 'Pics Stream';
        }

        public function getDescription() {
            return 'Pics stream for listing property pics.';
        }
    }