Drupal8利用区块和菜单

第1步:确认建设需求

1、A main navigational menu that links to the main sections of the site.

链接到站点主要部分的主导航菜单
2、A footer that lists key pages on the site, the company address, and contact
information

列出站点上的关键页面、公司地址和联系信息的页脚。

第2步,如何用drupal完成建设需求

1、Adding the Contact Form to the Main Menu

添加联系人窗体的主菜单

 add the contact form to the Main navigation menu (Structure ➤ Menus ➤ Main navigation). Edit the menu, click the “Add link” button, and add a new menu item with a “Menu link title”of “Contact Us” and a Path of “contact.” save.

添加联系方式主导航菜单(Structure ➤ Menus ➤ Main navigation)。编辑菜单,单击“添加链接”按钮,并添加一个新菜单项,菜单链接标题为“Contact Us”和“contact”路径。保存。



(注意:路径要以/或?或#开头,不然保存不了,会报错。)

2、Creating the Footer

创建页脚

The footer will display the Main navigation menu, company address, and contact information. All three elements will be displayed using blocks via the Block layout. The Main navigation menu block already exists,as it was created when installing Drupal 8. We’ll create a custom block for the company address, create another block for contact information, and assign all three blocks to the footer region (depending on which theme you have selected, the actual names of the regions may vary) using the steps outlined in Chapter 10.

页脚将显示主导航菜单、公司地址和联系信息。所有三个元素都将通过块布局来显示。主导航菜单块已经存在,因为它是建立在安装Drupal 8。我们将创建一个自定义的公司地址块,另一块创建联系人信息,并将所有三块到页脚区域(取决于您选择的主题,它的地区的实际名称可能有所不同)


1) custom add blocks

1)自定义添加区块



2) Click footer's place block,placing blocks, the main navigation menu block default, do not need to define their own, but still need to put the block, each placed a block, save once,.3 blocks are put, save the block configuration

2)点击Footer的Place block,放置区块,主导航菜单区块默认存在,不需要自己定义,但是仍然需要放置区块,每放置一个区块,保存一次。3个区块都放好后,保存区块配置。



补充:After creating the company address and contact information blocks and assigning all three blocks to the footer, it’s time for a little CSS work to make the blocks appear left to right instead of stacked on top of each other, and to change a few colors. After the CSS updates, the footer is ready for production .在创建公司地址和联系信息块并将所有三个块分配给页脚之后,现在是时候进行一点CSS工作,使这些块出现在左到右而不是堆叠在一起,并改变一些颜色。


阅读更多

更多精彩内容