div[class*=”col-“]{ color: green; } Note that this selector is different as it references a class attribute that starts with the word. div[class^=”col-“]{ color: green; }
Category: Uncategorized
Altering Pathauto pattern
Note that this hook works only if the default pattern is set up for the entity that you’d like to alter. admin/config/search/path/patterns function hook_pathauto_pattern_alter(&$pattern, array $context) { if ($context[‘module’] == ‘node’ && $context[‘bundle’] == ‘l_standard’ && ($context[‘op’] == ‘insert’ or $context[‘op’] == ‘update’ or $context[‘op’] == ‘bulkupdate’)) { $pattern->setPattern(‘library/services/[node:title]’); } } This allows for conditional… Continue reading Altering Pathauto pattern
Drupal 8 view filter styling
Displaying filters as four columns in Drupal 8 using the Bootstrap theme. Use Autoprefixer. .view-filters{ .form-inline{ .form-group{ margin-bottom: $spacing / 2; } } .form-control{ width: 100%; } .select-wrapper{ width: 100%; } } @media (min-width: $screen-sm-min) { .view-filters{ .form-inline{ display: flex; flex-wrap: wrap; .form-group{ flex: 1 0 25%; max-width: 25%; padding: 0 15px; } .form-actions{ flex: 1… Continue reading Drupal 8 view filter styling
AdBlock disabling images
I realized that my AdBlock blocked the images, that started with “advert” keyword. Failed to load resource: net::ERR_BLOCKED_BY_CLIENT The AdBlock is currently used by 10000000 users. Other AdBlocks could use similar algorithms to detect ads. To be safe, I will avoid using “advert” or “ad” keywords in image titles.
WYSIWYG new line
A comment that I often need to add when demonstrating how to use the WYSIWYG editor. If you want to go to a next line, without creating a new paragraph; hold the “Shift” button and then hit “Enter”.
Required field icon fix
Required field icon fix to Drupal 8’s Bootstrap theme, https://www.drupal.org/project/bootstrap Default: .form-required:after{ vertical-align: super; margin: 0 0.3em; background-size: 7px 7px; width: 7px; height: 7px; } After fix:
Naming convention in drupal 8
I struggle with coming up with machine names for fields in Drupal. When a field is created, Drupal creates database structure using those names. As for most of the projects, I tend to use incremental methodology. At times I’m forced to change the field names. The human-readable title can be changed at any time, however,… Continue reading Naming convention in drupal 8
Drupal 8 development notes
List of public static functions in Drupal class https://api.drupal.org/api/drupal/core%21lib%21Drupal.php/class/Drupal/8.5.x List of hooks https://api.drupal.org/api/drupal/core!core.api.php/group/hooks/8.5.x Preprocessors https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21theme.api.php/function/hook_preprocess_HOOK/8.5.x
Web project check list
A checklist that I use when pushing websites live. This varies from project to project and it depends on the framework, hosting, etc. On the development server Add Google Analytics 301 Redirects in a text document Generating XML sitemap Generate compresses, auto prefixes CSS Test meta tags using https://developers.facebook.com/tools/debug/ On the live website Backup the old… Continue reading Web project check list
CSS centering things vertically
display: flex; align-items: center; justify-content: center; Remember to auto add prefixes when compiling. Or. position: relative; top: 50%; transform: translateY(-50%);