![]() Path: '/ first-page' - the path to your route. This name must be unique, it is best to use module_name.rout_name, because you can have several routes in one module: drupalbook.first_page, cond_page and so on. Let's take a closer look at what is in this YML file.ĭrupalbook.first_page: - here is the name of our route, the path along which the drupal will collect a list of all routes, paths. ![]() _controller: '\Drupal\drupalbook\Controller\FirstPageController::content' To do this, we need to create another YML file : drupalbook.first_page: To get started, we will display plain text on the page. Now that we have the include module, we can add functionality and it will work on our site. Go to the Extend page and enable your module: Formatting is very important for a YML file, if an error is made in the formatting, an extra space or a colon is missing, then Drupal may give an error or the YML file cannot be read correctly. ![]() Fields and values in YML files are separated by a colon, a new line comes with indentation in two spaces. info.yml.ĭrupal YML files are a standard format for configurations and settings. The file name itself consists of the module name +. The information that is indicated in it will be displayed on the Extend page. info.yml file is responsible for the description of the module. In this folder we will need to create the file: name: DrupalBookĭescription: Custom module for learning Drupal 8 Create the folder /modules/custom/drupalbook. Also, if you change some code in the plug-in module (which should be done only if absolutely necessary), then it would also be nice to move it to the custom folder so that you do not accidentally overwrite the changes during the update (or another programmer will overwrite your changes or even you will overwrite, Suspecting nothing, changes of another programmer). Such a trifle as dividing modules into contrib, custom folders seems so unnecessary, but believe me, when there are 200 counter modules and 30 custom modules on your site, you will understand how difficult it is to find all the custom modules and all the custom code on the site. The contrib folder will store additional modules from, and our custom modules will be stored in the custom folder. Inside the /modules folder, we will create two custom and contrib folders. Now we do not need to put them deep into /sites/all/modules, although readme says that this should work, use the /modules folder after all. In Drupal modules are in the / modules folder. Let's continue to separate custom and contributed modules. Let's start creating our module with a little ordering.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |