directus-8-extensions
directus-8-extensions copied to clipboard
Adding helpers in server
I was trying to add the search module to my app. I add the module, add the endpoint but when i do the request says missing Class \Helpers\Search
where is the helpler/search.php file need to be placed in directus ?
In the helpers/functions.php is the script to auto load the helper files. You can include this file in your project config file.
Hi,
Sorry I'm newbie in Directus and I've the same issue to start with this extension pack.
I'm using docker env and the workspace is ready with your extensions but I don't find how to call helpers/functions.php
with my settings (only one project set by docker-compose, init sql script is in charge of the app init).
If you can drive me on the good track it will help!
Thanks a lot in advance and have a nice day.
br guillain
Ideally, the helpers/functions.php
file is imported in the hooks files, but if you are not using any hooks, include helpers/functions.php
in your project configuration file.
I am not fully versed in docker, but you should be able to include the file once.
Let me know how that goes.
Hi Philleep, Thanks for your feedback. As you can see in the support slack channel, I had an issue on office365 SMTP interco. This blocked the login step due to the exception of the extension hooks/request/hooks.php (l. 35). I used as workarround gmail and it's ok for the login step but no change in the GUI and no notification (?). To check the settings, I added the email notification hook example provided by Directus (as simple test), but stil no notification. So I'll check why hooks are not working as expected. My feeling is I'm missed something in my conf to load properly the extension(s). I let you know when I've consistent news ^^ and Thanks again for the support =)
Hi, Good news, it's fixed on Dockerfile side. To do it massively with this extension pack (useful for testing purpose as It's not elegant with two loops due to the constrainst on the source path of the directus-extension tools... but it works ^^)
FROM directus/directus:v8.7.1-apache
LABEL maintainer="guillain"
# Update pkg and install the needs
RUN apt -y update && apt -y install npm
# Install PHP extensions
RUN php-ini-add "upload_max_filesize=32M" && \
php-ini-add "post_max_size=64M"
# Install PHP extensions
# RUN docker-php-ext-enable redis
# Install composer packages
RUN composer require league/flysystem-aws-s3-v3
# Install NPM modules
RUN npm install -g @directus/extension-toolkit
# Add PhilleepFlorence's extensions
RUN git clone https://github.com/philleepflorence/directus-8-extensions.git /tmp/extensions
# && \
#cp -fr /tmp/directus-8-extensions/* /var/directus/public/extensions/custom/ && \
#rm -fr /tmp/directus-8-extensions
## Create custom Interfaces
RUN mkdir -p /var/directus/public/extensions/custom/interfaces && \
cd /tmp/extensions/interfaces/ && \
for custo in $(ls); do echo ">>>>>>>>>> ${custo}"; cd ${custo}; npm install && directus-extensions build --input "./src" --output "/var/directus/public/extensions/custom/interfaces/${custo}"; cd ..; done
## Create custom Modules
RUN mkdir -p /var/directus/public/extensions/custom/modules && \
cd /tmp/extensions/modules/ && \
for custo in $(ls); do echo ">>>>>>>>>> ${custo}"; cd ${custo}; npm install && directus-extensions build --input "./src" --output "/var/directus/public/extensions/custom/modules/${custo}"; cd ..; done
## Copy static files
RUN cd /tmp/extensions/ && \
cp -fr components endpoints hooks mail styles core helpers scripts vendor /var/directus/public/extensions/custom/
# Set perm on Public folder
RUN chown -R www-data:www-data /var/directus/public && \
chmod -R 775 /var/directus/public
Thanks and have a nice weekend =)