Peter Lozovitskiy
  • Member for 9 years, 8 months
  • Last seen this week
How do I programmatically show a view block?
24 votes

If you want to pass a parameter to the view use: echo views_embed_view('view_machine_name', 'block_1', $param); For example: echo views_embed_view('view_machine_name', 'block_1', $node->nid); ...

View answer
Drupal 7 - Suppress output of nodes on Taxonomy Pages
8 votes

Solution from http://www.wardontheweb.com/remove-node-lists-from-taxonomy-pages-in-drupal-7/ works for me well: function THEMENAME_preprocess_page(&$vars){ if (arg(0) == 'taxonomy' && ...

View answer
How can I add a cancel button to the content add form for a single content type?
7 votes

All those solutions are for adding Cancel link not a button! If you want to add the button instead of a link you should use this code for module cancel_button.module: function ...

View answer
How to get teaser break to work with WYSIWYG + CKEDITOR?
6 votes

Adding <!--> to the set of allowed HTML tags for the Filtered HTML format solved this problem for me. To do so, these are the steps to be performed: Navigate to admin/config/content/formats/...

View answer
How to show terms in a Views in its hierarchical structure?
4 votes

I've solved similar task by using the Taxonomy menu module. Transform any of your taxonomy vocabularies into existing menus easily! Features: Custom Menu per vocabulary Uses the ...

View answer
Display a custom field of a content type in template with PHP?
4 votes

$node->field_widget_position['en'][0]['value'] This is a bad solution. The right solution is render(field_view_field('node', $node, 'field_widget_position')); or render(field_view_field('node',...

View answer
Get current currency symbol in drupal commerce
3 votes

With the Commerce Multicurrency module and Drupal 7, you can use the following code. $enabled_curr = commerce_currencies(TRUE); $current_curr = $enabled_curr[...

View answer
Drupal Commerce: Get selected payment method programmatically
3 votes

Each payment method is a rule. Let's get the rule name than: $payment_method = ''; $order = commerce_order_load($order_id); $r = explode('|', $order->data['payment_method']); if (count($r) > 1){...

View answer
How to use hook_views_query_alter to add field with no table in Drupal 7 Views 3
3 votes

I had the same problem. And I've solved it. function ModuleName_views_query_alter(&$view, &$query) { if ($view->name == 'my_view' && 'my_block_name' == $view->...

View answer
How to get product name by id from commerce order?
2 votes

The entity_load() is deprecated since 8.0.0. For Drupal 9 use: // Several product ids to load. $product_id_to_load = [34, 342, 567]; if (count($product_id_to_load) > 0) { $entity_manager = \...

View answer
Responsive bootstrap grid with 6 columns of equal heights
2 votes

You should use 'Bootstrap Grid' format for Views in some cases, which you'll be able to select after install/enable of the Views Bootstrap module. Here is a quote about this module (from its project ...

View answer
Drupal commerce order total ignore changed unit price
Accepted answer
2 votes

Try to downgrade rules to v 2.7. For more details look at https://www.drupal.org/node/2408705 Important: Rules 2.8 has a critical regression that causes checkout rules to not work. Follow #...

View answer
Entity Reference create problem with REST server using Services
2 votes

I tried Philipp's way but no luck. In my case (widget type is select and services-7.x-3.3) "field_reference": {"und": "977"} works. Where 977 is a nid.

View answer
Show a custom field in a block
2 votes

I would use the following code, to render a field. render(field_view_field('node', $node, 'field_test1'));

View answer
This import is empty and if applied would delete all of your configurations
1 votes

Do double check the directory where the config files are located. The directory is set in settings.php like: $config_directories['sync'] = 'sites/default/files/[...]/sync'; I had the same issue but ...

View answer
In Drupal Commerce how can you turn product select box options into images?
Accepted answer
1 votes

If you need images (not just colored blocks) as commerce product options take a look at commerce_options_as_images I've created this module and use in on my projects.

View answer
Views No results Behaviour Show All
1 votes

BTW: If you want to show just empty map (without markers), you may add a 'Global: TextArea' to 'No Result Behaviour' and put the text area inside: <script src="http://maps.googleapis.com/maps/api/...

View answer
Force existing users to complete profile after adding required fields
Accepted answer
1 votes

Peter, there are two modules for such thing: complete_profile pfff But.. I want to try your rules solution because the modules above don't work with hybridauth :(. If you don't use hybridauth you'...

View answer
Overriding theme_item_list in a context
1 votes

You can to get rid of the surrounding wrappers by overriding theme_item_list($variables) function in you template.php or module and comment hardcoded lines: $output = '<div class="item-list"&...

View answer
How do I restore the comment body field I deleted from a content type?
0 votes

I recovered comments with recreating the tables (take care: all the comments will be removed): comment, field_data_comment_body, field_revision_comment_body; and reset statistics with: UPDATE ...

View answer
site returns 404 on every request, except /
0 votes

If apache2 installed on your server make sure mod_rewrite (rewrite) enabled. In Ubuntu case you can check this by commend: ls /etc/apache2/mods-enabled/ | grep rewrite If result is empty, you have ...

View answer
Why would drush sql-sync fail to work?
0 votes

I've solved my problem with sql-sync after I updated the drush version on my localhost. It was 5.7 on localhost and 6.0-rc4 on server. After update the drush version on localhost is 7.0-dev. sql-sync ...

View answer
Using taxonomy terms alias in views contextual filters
0 votes

You can use views, pathauto and taxonomy_display modules together. The taxonomy_display module lets override the term's page by your custom view and make it accessible by drupal native pathauto alias. ...

View answer
Organic groups organizational problem
0 votes

I had the same case. I removed the entity reference (which cause the problem) from Relationships and added necessary fields with Rendered Entity Formatter. You can choose any view mode you want ...

View answer
Use Checkboxes with Drupal Better Exposed filter
0 votes

It's possible to make checkboxes list for nodes. Here is a good manual for Drupal 6: Filtering A View By A List Of Nodes With Checkboxes. It helped me with D7 also. For Drupal 7 it requires several ...

View answer
Change Drupal Commerce line item titles
0 votes

There are sevetal methods for this: You can set the product title as you want on /admin/commerce/products page. Edit product and set your title. You can set the product title in a moment you add it. ...

View answer
Removing line breaks in Twig
-1 votes

The solution {{ body|replace({"\n": "", "\r": "", "\t": ""}) }} works for me in views Global/Custom text field. It removes new lines from ...

View answer
Generating <button type="submit"> with the form API
-3 votes

More correct way is: $form['submit'] = array( '#type' => 'button', '#value' => '<span>Login</span>', ); It produces valid HTML like this: <button value="&lt;span&gt;...

View answer