Drupal 7 .inc files in custom module - drupal-modules

Firstly let me tell all of you that I am a novice to Drupal and trying to Explore it by my own.
I installed MD_FOTO theme from https://www.drupal.org/project/md_foto and its custom module 'md_foto_features' in my test drupal site and its working fine.
I am trying to explore this custom module, I doubt if it will work as this module contains many .inc files like "md_foto_features.context.inc" as one of them but this file is not loaded using include/include_once/require/require_once.
My question is, How is this file being included(loaded) in order to use functions defined in this file ?
Thanks in advance !!!

md_foto_features is a module generated via feature. These inc files are automatically include via feature modules.
http://cgit.drupalcode.org/features/tree/features.module#n396

Related

How to build a blog using next.js?

I'm new to web development, recently I want to build my own blog. I use Next.js to host my pages, I have already got the skeleton done, but there are still some significant problems.
How to render pages from markdown file? I just don't know how others do this. Do I have to use fs in the 'server.js' file and respond to certain request by md file? Or there are other ways?
If step 1 was completed, I wonder if I have <img> tags in my markdown file which refer to some local pictures, how can I render those?
To answer 1. You can use the npm package markdown-to-jsx .
But I strongly recommend using Docusorous or GatsbyJS for this purpose. Both have your requirement inbuilt.
Secondly, for Images - You can always include them in Markdown and they will be converted to JSX using markdown-to-jsx .

Can we generate CPP files out of WINRT/header files?

I see that we've a bunch of header files and references(winmd) ,in windows 10 SDK. Is there any way I can generate cpp files as well out of these so that I can compile all of them together and create a library out of this ?
Basically, what I want is : I do not want to include the publicly available WINRT header files inside my app directly. Instead, I want to create a WINRT library with all the WINRT definitions which can be referred/linked to in my app. I'll expose the required definitions via some subset of header files.
Let me know if this is possible.
Thanks in advance.
You can use the cppwinrt.exe tool that ship in the Windows SDK to generate your own headers that you can then include in your project.

How to write a node-webkit application with custom modules?

I am currently writing a node-webkit application. The application supports certain modules which lie in the module folder inside the application.
I would like to dynamically install and remove those modules from inside the application. For that i would need to dynamically write inside the application.nw file. Is there a best practice solution to my problem?
That's not really a good idea. Just create a folder for app files and put downloaded packages there.

How does Orchard resolve references in modules?

The documentation (here and here) is notably lacking information on how references in modules are resolved:
References Resolution
(TODO: Explain how Orchard figures out references by looking at the "References" section of the csproj file as well as looking at additional assembly binaries dropped in each module "bin" directory)
Unfortunately, this is exactly the information that I need. I have created a custom module that has a reference to a custom-built, in-house DLL. When I try to use a class from this DLL, I get the following Exception:
Could not load type 'Custom.MyClass' from assembly 'Custom, Version=[version], Culture=[culture], PublicKeyToken=[token]'.
So, my question is thus: What does Orchard do with module references, and is there anything special I need to do to have Orchard pick up my module's references?
EDIT: Looks like some better information can be found in this blog post and its comments. However, my custom assembly already exists in src\Orchard.Web\App_Data\Dependencies, and I'm still getting the error.
EDIT2: We have a copy of the custom DLL in the lib folder, so I tried referencing that one instead (as we have another module that does so successfully), but still no change.
EDIT3:: In reference to the previous two edits, it's not copying from the lib folder to the App_Data\Dependencies folder. I just added a new DLL to the lib folder and referenced it, and it didn't appear in the Dependencies folder. I think the current Custom.dll isn't replacing the one that's there, which is why I'm getting the error I am. But why isn't Orchard copying into the Dependencies folder?
In order to have Orchard to use your custom module you need to have it on path: your_web_application_path/Modules/your_custom_module, we are using sym links to achieve that.
Then your main module (web application) should see your custom module. If you are adding new module to existing orchard app, you probably need to enable it by hand from admin panel/modules menu. For new installations you could add feature enable directive to your recipe and add dependency to main module.txt file (assuming you want your module always on).
Another trouble shooting tips:
make sure your module build path is set to bin/ folder (not some bin/debug etc.)
make sure your module is really an orchard module (have module.txt file) and is seen in admin panel/modules
make sure it is enabled, new modules are by default disabled
make sure referenced libraries are referenced from static folder I mean not from someting like bin which is clean up during rebuild

Orchard CMS Custom Module Project File

I have an existing solution (multiple projects, one MVC web project) that I'm trying to wrap into an Orchard module.
All documentation says that the web csproj should be at the root under my module directory (eg Modules/MyModule/MyWeb.csproj).
However, I have an existing solution structure where the sln file sits at the top level and each csproj file (and project content) sits in its own directory (the standard solution structure when you build a multi-project app in Visual Studio).
Is there a way I can tell my Module.txt file that the Orchard Module csproj is under MyModule/MyWeb/MyWeb.csproj? I'd prefer to not restructure the whole solution.
Thank you.
Note: As a point of clarification, it is not ~/Modules/MyModule/MyWeb.csproj but ~/Modules/MyModule/MyModule.csproj. The Folder name of the Module must match the file name of the project (before .csproj). This is enforced by the Dynamic Extension Loader, which requires ~/Module/{ModuleId}/{ModuleId}.csproj. (A similar approach is required for themes.)
The only potential way to do this is to write a custom module that follows the above that contains a custom loader. Within your module, create your own implementation of IExtensionLoader, and register it with Autofac. However, I don't know if it would work; I've never tried.
You will probably have an easier time reorganizing your solution.

Resources