Blog

Create new page

- You can create a new page by using "Add content" button on the "Content list" page /node/add.

   

Create a new block

- You can create a new block on the "Custom block library" page /admin/structure/block/block-content. See article about drupal 8 blocks

Tags:
Drupal 8, Basic, Content creation



Drupal Blocks list

You can see the list of existing blocks by using "Structure" -> "Block layout" menu item.

 block layout menu item 

Tags:
Drupal 8, blocks, Basic



let's repeat

When you create the views, on the first page you configure:

- What to display: users, nodes, comments etc.

- How to display: Page or block.

- Path to the page, title, pager, items per page, basic sort.

 

After that you can continue to configure the views, on the views edit page:

Tags:
Drupal 8, Views, Basic



View module allows you to  display the list of pages, orders, users etc. Most often it is used to display a list of content.

Let`s create our first view. Click on "Structure" -> "Views" link, "Add view" button.

View basic information

 

View settings

 

Tags:
Drupal 8, Basic, Views



Let`s learn how to switch Drupal 8 theme. Go to "Appearance" page and click "Install new theme". Open in the new tab bootstrap theme page https://www.drupal.org/project/bootstrap and copy link to tar.gz opposite 8.x

 

 and paste the link to the "Install from a URL" field and click "Install"

Tags:
Drupal 8, Basic, theme



Let's look фе  "Configuration" menu item in details.

People -> Account settings

 

Here you can:

- Enable/disable user contact form. The form is availbale on the user profile page. When form is submitted the user get notification to his email.

- Replace default name for Anonymous user.

- Choose Administrator role. Each user on drupal site has one or more roles. You can allow or deny access to the pages and features for each role.

Tags:
Drupal 8, Basic



I setup animation speed  by using "transition" property and image size by using "transform". transform: scale(1) - default state, transform: scale(1.1); - image magnification on hover. You may need to add "overflow:hidden;" to image parent element. As additional effect i use opacity

Tags:
css trick, css3, Sass



"Content" menu item

In order to list of created pages, comments or if you would like to add a new page use "Content" menu item. You can creat/delete/edit/publish/unpublish your pages there.

 

Structure menu item

There are a list of existing blocks at this page and you can add, delete, disable or edit block by "Block layout" link under "Structure" link. There are two types of blocks: system blocks and your custom blocks. 

Tags:
Drupal 8, Basic, configuration



Our current site view:

 

I reccomend to install "Admin toolbar" module at first. It's wery helpful module and we will have acess to all configurations pages from toolbar. Click  "Extend" link on the top of the page and "install new module" button on the opened page. After that open this link in the new tab https://www.drupal.org/project/admin_toolbar and copy tar.gz link to the latest version for Drupal 8.

Tags:
Drupal 8, Basic, Admin toolbar



MySQL database

1. Open your Cpanel

2. Find "MySQL® Databases" icon
 

Cpanel MySQL db manager


 

3. Type db name into "Create new database" field and click "Create" button



 

Tags:
Cpanel, Drupal 8



$user_id = \Drupal::currentUser()->id();
$node = \Drupal\node\Entity\Node::
Tags:
Drupal 8, node creation



function custom_module_user_insert($account) {
 
// Add new role to the user
Tags:
Drupal 8, hook_user_insert, code, hook



function custom_module_link_alter(&$variables) {
 
$current_path = \Drupal::req
Tags:
Drupal 8, hook, code, custom_module_link_alter



Remove user register tab
Tags:
Drupal 8, code, hook, hook_menu_local_tasks_alter



/**
 * Implements hook_preprocess_node().
 */
function custom_module_preprocess_node
Tags:
Drupal 8, hook_preprocess_node, code, hook



function custom_module_page_alter(&$page) {
 
if (\Drupal::service
Tags:
hook_page_alter, code, cache, Drupal 8



Sometimes it's necessary when you build custom drupal module. You can use RedirectResponse():
Tags:
Drupal 8, RedirectResponse



Redirect when user log in first time

Tags:
rupal 8, code, hook, hook_user_login



This hook is used most often in drupal web development.

Tags:
Drupal 8, code, hook, hook_form_alter



This hook is used most often.

Tags:
Drupal 8, code, hook, hook_form_alter



Pages