官术网_书友最值得收藏!

  • Drupal 8 Blueprints
  • Alex Burrows
  • 395字
  • 2021-07-03 00:03:25

Adding fields to our vocabulary

For our category page, we want a nice image to show. So, let's add an image field to this term page. From the current page, click on the breadcrumb Post category; this will take us back to the vocabulary page for Post category. Now that we are here, we can see tabs across the top. As we saw when we were creating our Post content type, we have the following:

  • Manage fields
  • Manage form display
  • Manage display

From here, we can again create and manage the display of the taxonomy term page. Let's add our image upload field.

As we did earlier, we click on + Add field and are again redirected to a configuration page for the field. Let's add our image field; select Reference | Image. Then, enter the label of Post category hero; this will again generate our machine name for the field. Let's save this and begin configuring the field as we did before; this time the field has a little bit more configuration to do.

On the image field settings, we can see that there is a radio button selected for Public files; if we had other file storage setup, such as Amazon S3, then this would show here. However, for now, we are using public files, which will save our images in /sites/default/files.

We then see some fields that allow us to upload a default image, alternative text and title. This will render inside the image when it displays on the site. Let's save this and continue to add the final bit of configuration for this field.

Again, we see fields similar to when we created our Post content, but we have some additional ones; we can do the following:

  • Set the allowed file extensions
  • Set the file directory
  • Set the default image
  • Set the maximum and minimum image dimensions
  • Set the maximum upload size of the file
  • Set what type of attribute will be required for the image

We only need to amend the allowed file extensions, as the others will be set to the default settings that are inside Drupal core.

Once we have done this, we can save our new fields and move on to the next part of the build, which is to add the taxonomy to the content type.

主站蜘蛛池模板: 麻阳| 封开县| 江安县| 兴文县| 湾仔区| 正宁县| 江川县| 蒙自县| 浠水县| 淳安县| 松阳县| 鹤庆县| 松滋市| 普陀区| 班玛县| 洛阳市| 收藏| 吉林省| 泸西县| 甘泉县| 霍邱县| 乡城县| 历史| 新乡县| 兴海县| 棋牌| 云南省| 双峰县| 怀安县| 内黄县| 岱山县| 惠东县| 个旧市| 黄龙县| 威远县| 武隆县| 华池县| 金沙县| 沐川县| 周口市| 淅川县|