Drupal 8 Form API

In Drupal 8.9.16 I created a custom module "example"

In example.routing.yml are the following instructions:

example.form_a:
  path: '/example/form-a'
  defaults:
    _form:  '\Drupal\example\Form\form_a'
    _title: 'EXAMPLE FORM A'
  requirements:
    _permission: 'access content'

example.form_b:
  path: '/example/form-b'
  defaults:
    _form:  '\Drupal\example\Form\forma_b'
    _title: 'EXAMPLE FORM B'
  requirements:
    _permission: 'access content'
 

undefined drupal_add_js function inside themename_preprocess_page

I am using Drupal 8.x and I wanted to use javascript to delete an option from the list of options within specific pages, i.e., content type, using a pattern of their machine names, i.e., proxy_request, in case the user is not an administrator and I searched and found this code inside a post and I used it inside the project's themes->mythemename->mythemename.theme file, but that didn't work and I have several problems I want to know how to solve, as I searched a lot I did not find a solution

Drush Site-install

I am having an issue on a new mac on Terminal that works with Composer and Drush that is fine. However when I'm on the /david/Sites/animals I go to the Terminal and I'm unable to make the "drush site-install" work.

For example

drush site-install --db-url=mysql://david:root@localhost:3306/animals

I get the following Terminal

undefined drupal_add_js function inside themename_preprocess_page

I wanted to use javascript to delete an option from the list of options in case the user is not an administrator and I searched and found this code inside a post and I used it inside the project's themes->mythemename->mythemename.theme file, but that didn't work and I have several problems I want to know how to solve, as I searched a lot I did not find a solution

How to display list of only comment subjects (no bodies)

We have articles on our site. At times, they attract long comments, and there are many such comments; However, once read, a normal user is not interested in reading those comments again and again. It becomes a pain to scroll thru the page to get to some desired comment.

Copy/Clone Content Type with fields

In a site I have to use a Content Type with many fields and I would like to copy it from another site without being forced to recreate every single field.
It's possible to do it?
In configuration there is configuration synchronization but I saw that only the Content Type passes and not the fields.
The copy should do it without the nodes

Pages

Subscribe with RSS Subscribe to RSS - Drupal 8.x