Sử dụng Drupal Widgets Module để nhân bản 1 nội dung

Sử dụng Drupal Widgets Module để nhân bản 1 nội dung

Use the Drupal Widgets Module For Reusable Content

The Widgets module allows you to centrally manage text and code snippets across your Drupal site.

You can also combine the snippets into sets for even easier re-use.

Widgets provides some pre-defined snippets but also allows you create your own. In this tutorial we're going to do both.

We're going to show you how to:

  1. Use pre-defined widgets to show social bookmarks on your site.
  2. Create your own reusable content.

Using the Widget Module to Add Social Bookmarks

Install both of these modules:

Enable both of those Widgets modules:

tutuploadsmedia_1337699830252.png

Also, we're going to enable several of the Service Links modules. Which ones you choose will depend on the target audience for the site, but enabling the following three options will give me Facebook, Twitter, Google Plus and other popular options.

  • Favorite Services
  • General Services
  • Widget Services
tutuploadsmedia_1337700051651.png
  • Go to Structure > Blocks and publish the Widgets: widgets_service_link-default module.
tutuploadsmedia_1337699866780.png

The module will look like this on the front of your site:

tutuploadsmedia_1337700302017.png
  • If you want to modify that block, go to Structure > Blocks > Widgets.
  • You'll see that your service links widget is the only availabe at the moment.
tutuploadsmedia_1337700351946.png
  • Click Edit.
  • Click Override defaults at the bottom of the page.
  • You can now rearrange all of the social icons and also add more.
tutuploadsmedia_1337700501045.png

Creating Your Own Widgets

Widgets also allows you to create your own reusable widgets.

To make full use of the power of custom widget, install and enable these two modules:

Those two modules will allow our widgets to be much more fexible.

  • Go to Structure > Widgets > Definitions.
  • Click Add widget definition.
  • Definition name: Enter a name for your new widget.
  • Template: Enter the text or code you want to use. You can use tokens. You can find the tokens for your site by clicking Help > Token.
tutuploadsmedia_1337701184317.png
  • Repeat the process with another widget:
tutuploadsmedia_1337701120480.png

Now we're going to join the two widgets together into a widget set.

  • Click the Sets tab.
  • Click Add widget set.
  • Enter a Set name.
  • Click Create new set.
tutuploadsmedia_1337701314825.png
  • You can now add any of the widgets. We're going to add the new widgets that we have just created.
tutuploadsmedia_1337701354506.png
  • When you're finished, the widget set will look like the image below:
tutuploadsmedia_1337701390186.png
  • Save the widget set.
  • Go to Structure > Blocks and your widget will now show as a block. Publish this block.
tutuploadsmedia_1337701414661.png
  • You should now be able to see the widget set live on the site.
tutuploadsmedia_1337701490572.png
  • You'll also be able to re-use this widget almost anywhere on the site using tokens. Your new widget set will appear in the list of available tokens found in Help > Token.

tutuploadsmedia_1337701706493.png

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Hướng dẫn tạo Custom Field Formatter trong Drupal 8

Hướng dẫn tạo Custom Field Formatter trong Drupal 8

In Drupal, field values are displayed to the end user via a field formatter. Formatters that come with fields are often pretty basic. 

Kiểm soát côn trùng Ruồi - Dịch vụ Diệt Ruồi

Kiểm soát côn trùng Ruồi - Dịch vụ Diệt Ruồi

Các bệnh mà ruồi đóng vai trò lây nhiễm bao gồm bệnh qua đường tiêu hóa như lỵ trực trùng, lỵ amíp , tả, thương hàn, giun đũa

Apple thử nghiệm máy tính bảng màn hình nhỏ

Apple thử nghiệm máy tính bảng màn hình nhỏ

Tập đoàn Apple đang hợp tác với các nhà cung cấp linh kiện ở Châu Á để thử nghiệm môt loại máy tính bảng mới với màn hình nhỏ hơn trong nỗ lực tìm kiếm mở rộng dòng sản phẩm trong bối cảnh cạnh tranh khốc liệt...

Công ty diệt chuột T&C

 

Diet con trung