Tuy nhiên, thông tin chứa đựng trong cuốn sách này được bán mà không có sự bảo đảm, thể hiện rõ ràng hay ngụ ý. Không phải là tác giả, cũng không phải xuất bản Packt, và các đại lý và nhà phân phối sẽ được tổ chức chịu trách nhiệm về bất kỳ thiệt hại | Drupal s Theme Layer The most obvious part of Drupal s theming system is the Appearance page which lists all of the themes installed on your website. When you choose a theme from the Appearance admin page you are applying a specific graphic design to your website s data and functionality. However the applied theme is in reality only a small part of the entire theming layer. Drupal s Theme Layer This book is mostly focused on building modules that encapsulate discrete chunks of functionality. However since we re ultimately building a web application everything outputted by your functionality will need to be marked up with HTML. Drupal calls the process of wrapping your data in HTML and CSS as theming. For the next two chapters we will discuss how your module should integrate with the theme layer. Chapter 3 will talk about the architecture of the system theme functions templates render elements and the theme registry. Chapter 4 will use these newly acquired concepts to integrate an example module with the theming layer. Business logic versus presentation logic So what would be the best way to get our data and functionality marked up Do we simply wrap each piece of data in HTML and return the whole as a giant string Like the following example return div class wrapper . data . div Fortunately we don t. Like all other well-designed applications Drupal separates its business logic from its presentation logic. Traditionally the primary motivations for this separation of concerns are as follows 1. To make the code easier to maintain. 2. To make it possible to easily swap out one layer s implementation without having to re-write the other layers. As we shall see Drupal takes the swap-ability aspect to the extreme. As we mentioned in the introduction of this chapter the default theme selected on the Appearance page is the most obvious part of the theme layer. Also you might think that the theme is responsible for applying the HTML and CSS for the website. However there are .