tailieunhanh - Drupal 7 Module Development phần 4

nào gây ra hoặc bị cáo buộc gây ra trực tiếp hoặc gián tiếp bởi cuốn sách này. Packt Publishing đã cố gắng để cung cấp thông tin thương hiệu về tất cả cácĐối số thứ hai, cảnh báo, là một phím định được thông qua để hook_mail (). | Theming a Module if is_array elements items key data elements items key data drupal_render elements items key data return elements In our single_blog_item_list_child_render function we simply loop through all the items determine if they have an array in their data element and call drupal_render on its contents. Attaching CSS to render arrays If you look at the screenshot of the first version you can see that the default styling of our block is less then inspiring so let s tweak that by giving our content some sensible default styling by adding a CSS stylesheet. Since version 5 Drupal has had a drupal_add_css function to add CSS stylesheets to pages. What s new in Drupal 7 is that due to Drupal s block and page caching and the capabilities of hook_page_alter we now need to attach our stylesheet directly to the render element that we are creating. If we were to use drupal_add_css the stylesheet would not be cached with its block and it would also be considerably more difficult to alter the stylesheet if a hook_page_alter implementation desired to For example if it removed the block and wanted to remove the CSS too. So instead of calling drupal_add_css from within our single_blog_block_view function we add it to the returned render array Add a CSS file to style the block. block content attached css drupal_get_path module single_blog . We use drupal_get_path to find the path to our module relative to the website root. The attached array can contain a list of CSS files and JS files to attach to our render element. For JavaScript files just append them to the js array via attached js . And here are the contents of our stylesheet Id .block-single-blog .content ul padding-left 0 LTR 102 Chapter 4 .block-single-blog .content ul li margin-bottom 10px list-style-type none RTL languages One thing you ll need to be aware of when writing stylesheets is Drupal s support for RTL languages those languages that are read Right To Left for example .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.