drupal-theming

Twig: how to check the inner html content of a field

假装没事ソ 提交于 2020-01-23 12:25:32
问题 i have a single field and that field can have one or two lines of html: <p>One line</p> or: <p>first line</p> <p>Second line </p> Using twig how can i check if the field has one or two tags. Example of what i want to do: {% if item|length('<p>') = 1 %} <div class="one">{{ item }}</div> {% elseif item|length('<p>') = 2 %} <div class="two">{{ item }}</div> {% endif %} Any ideas of how to accomplish this? Update #1: What Honza said is true I want the parent div to have a class if there is only

hook_preprocess_page() does not seem to use the suggested template file

霸气de小男生 提交于 2020-01-07 04:03:09
问题 I am suggesting a template file in the hook_preprocess_page() implementation done from a module, but the suggested template file doesn't seem to be used. The template file is page--terminal-template.tpl.php, which is in the directory containing the module, and this is the implementation of hook_preprocess_page() . function terminal_preprocess_page(&$variables) { if (arg(0) == "terminal") { $variables['theme_hook_suggestions'][] = "page__terminal_template"; } } Could anyone please help me? 回答1

Theme installation in drupal 8 Fails

南楼画角 提交于 2020-01-06 18:09:39
问题 i am a newbie in drupal. I installed drupal then tried to change the theme i tried three themes. Everytime i get the same error zircon_profile-8.x-1.0-beta11.zip does not contain any .info.yml files. name of the theme changes only. Am i missing any thing? Any help would be greatly appreciated. I tried getting themes from this site http://www.weebpal.com/free-drupal-themes. I followed steps from this site http://www.inmotionhosting.com/support/edu/drupal-8/themes/upload-new went to Apperance

Theme installation in drupal 8 Fails

。_饼干妹妹 提交于 2020-01-06 18:08:43
问题 i am a newbie in drupal. I installed drupal then tried to change the theme i tried three themes. Everytime i get the same error zircon_profile-8.x-1.0-beta11.zip does not contain any .info.yml files. name of the theme changes only. Am i missing any thing? Any help would be greatly appreciated. I tried getting themes from this site http://www.weebpal.com/free-drupal-themes. I followed steps from this site http://www.inmotionhosting.com/support/edu/drupal-8/themes/upload-new went to Apperance

Drupal - dynamically add class to wrapping div based on panel pane content node type

你。 提交于 2019-12-25 07:21:27
问题 Am using the drupal 7 panels everywhere module and i have set up a panel page template for my homepage. Problem is I need to add a class to a wrapping div in the template that is dependant on the node type inside the panel pane which is inside the wrapper. This needs to be added dynamically as our site editors will be moving panel panes around a lot. i.e. a row from my template looks like this: <div class="content_wrapper"> <div id="main-content-row1" class="content"> <?php print render(

Positioning elements within a page in Drupal 7

天大地大妈咪最大 提交于 2019-12-25 02:24:20
问题 I've got a set of divs in my page with some images inside of them. I would like them to be arranged horizontally instead of vertically ie: X X X X X X X X X X Instead of X X X ... X I've tried using the float , position:absolute properties but when using them the elements are "unattached" from the normal flow of the document and positioned outwith the content area. What is the best way to position elements in such a way without altering the normal flow of the document? Edit : <div id="content

drupal 7 cusomized user profile template can not save changes

泄露秘密 提交于 2019-12-25 02:13:08
问题 I want to custom my user profile edit page. The edit path is: xxx/user/2/edit 1. In my templage file: function MYTHEME_theme() { 'user_profile_form' => array( 'arguments' => array('form' => NULL), 'render element' => 'form', 'template' => 'user-profile-form', 'path' => drupal_get_path('theme', 'bootstrap_subtheme').'/templates', ), } function MYTHEME_preprocess_user_profile_form(&$vars) { drupal_set_title('Account settings'); unset($vars['form']['account']['mail']['#description']); $vars[

How to add javascript library in Drupal 8 theme?

纵然是瞬间 提交于 2019-12-24 11:16:18
问题 I'm attempting to include a custom javascript file to manipulate my menu's in the Drupal 8 theme I am building. I followed the instructions in the Drupal 8 themeing guide, including it in my .info.yml file: #js libraries libraries: - dcf/base and defining it in my .libraries.yml file: base: version: 1.x js: js/endscripts.js dependencies: - core/drupal - core/underscore - core/backbone - core/jquery and finally creating a .theme file with a hook implementation (I'm not really a PHP developer,

Theming Drupal 7's Ubercart “/cart” page

前提是你 提交于 2019-12-23 11:55:15
问题 I'm trying to theme Drupal 7's Ubercart 3 /cart page, but I'm struggling to find the theming function to do so. I believe the right code may be located in template.tpl.php , but I am not sure. Where in Drupal is the code to theme this page? 回答1: Create a new template file and name it page--cart.tpl.php For more information about Drupal theming suggestions: http://drupal.org/node/1089656 (Don't forget to clear the cache after adding the new template file) Another way to use Devel module with

How to add an HTML attribute to a CCK image field

和自甴很熟 提交于 2019-12-23 03:58:27
问题 I am trying to add an attribute of "id="background" to the actual image tag. <?php print render($content['field_bg_image']); ?> I've looked up tons of articles and they are all concerned with hook_form_alter and this is not a form. This is simply just an image field, I just need an ID attribute on it with a value of background. I know I can use javascript but I want to use Drupal and not add any more javascript. 回答1: The image render is run through theme_image_formatter() which doesn't let