Latest Articles
Our latest news updates and insightful blog posts, designed to empower you with the knowledge and strategies you need to succeed.
Code to create custom form in Drupal 8 and 9
Here is an example of a custom form with an email and message field in Drupal 8 or 9
use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; /** * Class CustomForm. */ class CustomForm extends FormBase { /** * {@inheritdoc} */ public function getFormId() { return 'custom_form'; } /** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { $form['email'] = [ '#type' => 'email', '#title…
CKEditor automatically strips classes from div in Drupal
Using CKEditor as a back end editor on my website. It is driving me round the bend though as it seems to want to change the code to how it sees fit whenever I press the source button.
Soln 1.
Follow this given step to resolve this issue.
Go to "Admin >> Configuration >> CKEditor"; under Profiles, choose your profile (e.g. Full).
Edit that profile, and on "Advanced Options >> Custom JavaScript configuration" add config.allowedContent = tru…
Cheat Sheet for using Twig Tweak in Drupal 10
1. **Render a View**:
- Use `drupal_view('view_name', 'display_id')` to embed a view.
- Replace `'view_name'` with the actual view name and `'display_id'` with the desired display (default is `'default'`).
- Example: `{{ drupal_view('who_s_new', 'block_1') }}.
2. **Get the Result of a View**:
- Retrieve the result of a view using `drupal_view_result('view_name', 'display_id')`.
- Parameters are the same as for rendering a view.
- Example: `{{ dr…
Can't save or submit anything after enable Boost in Drupal 7
I got the problem. After enabled and configured Boost, I cant change any single setting on the site, nothing gets saved. When hitting "Save" button on node edit form or any other submit form, the page just gets reloaded submit not working.
Solution.
This problem occurs only in the dev-version or Version 1.1. Version 1.0 is working well.
1. First install version 1.0 of the module. Activate that module. Go to admin/config/system/boost/htaccess/generator and ta…
Cache exclusion in Drupal - Disable cache for certain pages or template
These below code you can put on your template pages, you can apply condition according to requirement so so caching will exclude for those pages where apply this code.
$GLOBALS['conf']['cache'] = FALSE; $GLOBALS['do_not_cache'] = 1;
We can use CacheExclude module to manage caching for perticular page or condition https://www.drupal.org/project/cacheexclude
Assigning a Role to Customers in Drupal Commerce (Drupal 10)
- Open the Configuration Page
Navigate to:
👉 Admin Panel → Configuration
Or directly visit:/admin/config
Access Profile Types
- Click…
Apply coupon to Regular Price in Woocommerce
When we apply coupon for discount its applied for sale price by default but we need to apply discount coupon on regular price so you can use this code on function.php By default cart and product show sale price after applying this code Regular price will be update on cart.
add_action( 'woocommerce_before_calculate_totals', 'add_custom_price', 10, 1); function add_custom_price( $cart_object) { global $woocommerce; if ( is_admin() && ! defined( 'DOING_AJAX' ) )…
Add External CSS in Drupal 8
How can add externalcss in Drupal 8 ?
Post following format in libraries.yml, for example my theme name is customtheme so the file will be 'customtheme.libraries.yml' in theme folder
css: theme: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css': { type: external, minified: true } 'https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap': { type: external, minified: true }…
Boost Rankings, Traffic, and Dominate Search
In the fast-paced world of online news, getting noticed amidst the sea of content can be a daunting task. However, with the right strategies in place, news publishers can optimize their content to rank higher in search engine results, drive more traffic to their websites, and ultimately establish authority in their respective niches. This guide explores the key tactics for mastering News SEO and achieving digital dominance.
Understanding the Importance of News SEO
News SEO refer…
What is Lorem Ipsum?
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more rec…