- 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.
- Learning LibGDX Game Development(Second Edition)
- Mastering Visual Studio 2017
- PHP程序設計(慕課版)
- FreeSWITCH 1.6 Cookbook
- Java Web及其框架技術
- MySQL數據庫管理與開發實踐教程 (清華電腦學堂)
- Python算法從菜鳥到達人
- MATLAB for Machine Learning
- Mastering openFrameworks:Creative Coding Demystified
- 智能搜索和推薦系統:原理、算法與應用
- Frank Kane's Taming Big Data with Apache Spark and Python
- 詳解MATLAB圖形繪制技術
- 零基礎學C語言(升級版)
- Python程序設計開發寶典
- JSP程序設計與案例實戰(慕課版)