Drupal 8 FAQ
Below are the list of questions that you might find helpful for your next ventures :
Question : On Drupal 8 the template engine for the php is changed. What is the name of the present one?
Ans : Twig
Question : In Drupal 8 which module is inserted into the core?
Ans : Views
Question : When you add a new language to your site based on Drupal 8, the PO file is automatically downloaded from the site: True or False ?
Ans : True
Question : On which Framework is Drupal 8 based?
Ans : Symfony
Question : Is it possible to disable modules on Drupal 8?
Ans : No
Question : In D8, The default theme is already responsive:
Ans : True
Question : Now on Drupal 8 there is the possibility to insert more than once the same blocks: True or False ?
Ans : True
Question : By default a text editor is enabled on Drupal 8: True or False ?
Ans : True
Question : On Drupal 8 the creation of a custom block has been moved inside a module which is located in the core: True or False ?
Ans : True and it is called "Custom Block"
Question : Which version of Drupal 8 works with php?
Ans : 5.5.9 or higher
Question : How new * . js script are inserted through the theme layer?
Ans : via themeName.libraries.yml
The process To load CSS or JS assets:
- Save the CSS or JS to a file using the proper naming conventions and file structure.
- Define a "library", which can contain both CSS and JS files.
themename.libraries.yml OR modulename.libraries.yml - "Attach" the library to all pages (e.g. via themename.info.yml file), to specific Twig templates (e.g. {{ attach_library('modulename/libraryname') }} in *.html.twig), to a render element in a preprocess function (e.g. implementing THEME_preprocess_HOOK() hook in themename.theme file), or may be $form['#attached']['library'][] = 'modulename/libraryname' to attach to specific form.
Question : How an asset can be removed from a library?
Ans : setting up a false asset on * . libraries . yml file
Question : How overriding a library?
Ans :
Wrong: libraries-override on libraries.yml file
Correct: libraries-override on info.yml file
Wrong: libraries-override on libraries.yml file
Correct: libraries-override on info.yml file
Question : How can you set a variable in a * . html . twig template?
Ans :
Wrong: {{ set varName = * }}
Correct: {% set varName = * %}
Wrong: {{ set varName = * }}
Correct: {% set varName = * %}
Question : Which region is not present as default?
Ans : top
Question : How to load js files in the footer of the document?
Ans : Wrong: on themeName . libraries . yml set {scope: footer} to the file
Wrong: on themeNeme . info . yml, use the key js-load : footer
Correct: it is a default for drupal 8
Wrong: on themeNeme . info . yml, use the key js-load : footer
Correct: it is a default for drupal 8
Question : How to remove css file through the theme layer?
Ans : via stylesheets-remove in themeName . info . yml
Question : {{ var1|t }}: which kind of output it will give?
Ans : it will apply a t filter to a var1
Question : The {{ var|raw }} filter is:
Ans : a twig native filter
Question : How can you write a comment in twig?
Ans : {# stuff #}
Question : Which class a Controller needs to extend?
Ans :
Wrong: ActionManager
Correct: Controller
Wrong: ActionManager
Correct: Controller
Question : Which is the architectural pattern Symfony2 is based on?
Ans : Model View Controller
Question : What is Doctrine?
Ans : An ORM able to map entities, modelled by classes, in a database based on a relational logic
Question : What does the acronym DBAL mean?
Ans : Database Abstraction Layer
Question : Which annotation is necessary to specify that a given class needs to be identified as entity?
Ans :
Wrong: @ORM\Doctrine
Correct: @ORM\Entity
Wrong: @ORM\Doctrine
Correct: @ORM\Entity
Question : How can I specify the routing path If I don't want to use the specific file . yml?
Ans : Trough annotations
Question : Which method can be called out to formally insert data in the database?
Ans : Wrong: insert()
Wrong: update()
Correct: flush()
Wrong: update()
Correct: flush()
Question : What is the right command to upload fixture inside the using database?
Ans :
Wrong: php app / console generate:fixture
Correct: php app / console doctrine:fixtures:load
Wrong: php app / console generate:fixture
Correct: php app / console doctrine:fixtures:load
Question : Which file has useful information about the connection with the application database?
Ans : parameters . yml
Question : What is the module that redirects all the emails from the website to only one email address?
Ans : Reroute email.
Question : The Maintenance mode allows Drupal to:
Ans : Wrong : Render the system not accessible and visible to the anonymous visitors and non-admin users..
Question : Can pages 404 / 403, available in Drupal, be modified?
Ans : Yes, on the "site-information" page it is possible to easily create nodes to associate with them.
Question : The PathAuto module allows you to:
Ans : Automatically generate URLs for contents, users and taxonomy.
Question : Scenario: if you need to add to a upload field for the images to a content type, what do you use?
Ans : By default Drupal allows you to create an image field, where is possible to do the uploading.
Question : Drupal makes available (by default) a module for "statistics" that allows it to:
Ans : See how many times a defined page is displayed.
Question : What is the contrib module Fences is used for?
Ans : Fences module allows you to easily assign a specific HTML tag element to a field everywhere it's used, overriding the default Drupal field template.
Question : Is a stable version of Drupal 8 out now?
Ans : November 19, 2015
Question : Drupal makes available a "whatchdog" page where it is possible to:
Ans : Find a log of the events treated by the CMS.
Question : In a Drupal website with multiple languages does the "Search" module of Drupal core show you the search results filtered by the language used by the user doing the search?
Ans : No.
Question : How can I link my Drupal installation to a second database?
Ans : Through the settings.php file, specifying link data and access connection.
Question : With the Feature module, after changing settings of a content type (inside a feature), how do I find the difference with the previous version?
Ans : I must install an additional module: Diff.
Question : Scenario: You are managing a Drupal 7 website which provides content in three different languages: English, Spanish and Chinese. There are only three nodes in the database, one for each language. All nodes are from the content type "Press release". In particular, each of them has set "Drupal skills" as the title value. How does the default Drupal search behave when the user is browsing the English version of the website ( / en / prefix, session language set to English) and searches for "Drupal"?
Ans : All the three nodes get displayed as search results.
Question : Which is the Drush command to import the database?
Ans : drush sql-cli < / pathdatabase.
Question : URL rewrite is an important feature which lets every website have a chance to appear in a better position on SERPs. By default, Drupal 7 handles URL rewrites and also a set of contrib modules allowing Drupal builders to configure node default URL like, for example, / content / my-first-news instead of / node / 321. Given that, even in this situation the URL / node / 321 may still be accessible and this gets indexed by search engines. Which module do I have to pick if I want to redirect a user or crawler from / node / 321 to / content / my-first-news?
Ans : Global Redirect is a contrib module which, between many other functionalities, automatically sets redirects from / node / $nid to the SEF URL
Question : Does the "search_api" module use "search" module of the Drupal core?
Ans : No.
Question : Which of these modules allow to quickly insert one or more entities to a node?
Ans : Inline Entity Form.
Question : Is it recommended, if necessary, to write code by hand inside a file.module generated by Features?
Ans :Yes: the file . module generated by Features is of equal concept to whatever file . module in the Drupal architecture.
Question : The "format_string" function allows you to:
Ans : Format the passed string for the HTML visualisation replacing the passed variables to the placeholders.
Question : You created custom blocks using the Drupal backend interface and you installed features_extra to export these blocks into a feature. When you try to create the feature you don't find the blocks you created listed. What happened?
Ans : Features_extra adds to the custom blocks an input field which inserts the block machine-name. The blocks without it aren't shown in the block list on the feature creation interface.
Question : Does a hook exist to add information on the used JavaScript libraries (i.e. inside of an "Omega" theme)? If yes, which?
Ans : Yes. hook_libraries_info.
Question : By which "Ajax command" can you take action to replace an element of the DOM?
Ans : ajax_command_replace.
Question : Which property of the $user object specifies the first login to the website from a user?
Ans : $user->access.
Question : The hook "hook_node_validate":
Ans : Runs the node verification before it's created or updated.
Question : is it possible to override a theme function in a custom module?
Ans : Correct: Yes: but require other interventions such as hook_theme_registry_alter() or hook_theme() implementation.
Wrong: No: the theme functions can be overridden only in the template.php file.
Wrong: Yes: the theme functions can be overridden by default even in the custom module.
Wrong: No: the theme functions can be overridden only in the template.php file.
Wrong: Yes: the theme functions can be overridden by default even in the custom module.
Question : The "drupal_static()" function allows you to:
Ans : Correct: Save a variable in the cache inside a single page request / just for the duration of a single page loading. Wrong: Save a variable inside the Drupal's cache pages.
Question : Using the Drupal core "Search" module is it possible to customize / render a defined data to add to a node to index?
Ans : Correct: Yes, with the "hook_node_update_index" function, taking back a string that will be added to the node information to index.
Wrong: Yes, it's possible only by the use of the "Search API" module.
Wrong: Yes, it's possible only by the use of the "Search API" module.
Question : Which is the scope of "file_usage_add" function?
Ans : It records that a module uses a file, what object is used in it, what type of object it is and the module that is responsible for it.
Question : Scenario: Drupal 7 is installed as a backend of a Varnish reverse proxy. Everything is set up in your own corporate-behind-the-firewall environment. As a Drupal Builder, you need to wipe single node Page cache upon node save, without erasing all the website caches. Pick the best option between the following:
Ans : Expire and Varnish modules provide an easy way to do that: Expire has an option to empty proxy cache on node save; with this flagged, Expire will interface with Varnish in order to perform a "ban" request. Anyway, additional configuration on the Varnish side is mandatory.
Question : You just added a couple of fields to a content type, and now you need a third one built with the computation of the values entered in the first two. This third field should be available in the "Manage display " backend interface for that content type. Which of the following answers is correct and is the best approach in this case?
Ans : Correct: I create a custom module and use hook_field_extra_fields() and hook_node_view() to create one pseudo-field.
Wrong: I intercept the fields in one hook_preprocess_node, run the computation to create the third field and make it available as a new variable for the node . tpl . php template.
Wrong: I intercept the fields in one hook_preprocess_node, run the computation to create the third field and make it available as a new variable for the node . tpl . php template.
Question : The name Drupal derives from the Dutch word "druppel," which means "drop":
Ans : True
Question : By default, if a user has privileges in the X group, it inherits them also for subgroups and there is no way to do otherwise:
Ans : Correct: True Wrong: False
Question : Does New Relic a powerful tool to cache and staticize Drupal content?
Ans : False, it is a monitoring tool
Question : What is a theme hook?
Ans : An identifier used by the calls to the theme() function to delegate rendering to a theme function or theme template
Question : What is the Machine name?
Ans : The text string used by the computer to identify a resource, as opposed to the human readable name shown in the user interface
Question : Without installing modules, is it possible to create more block to insert views exposed filters?
Ans : Wrong: Yes, it's inside views settings when I create or edit the view
Wrong: Yes, it's inside exposed filters option
Wrong: Yes, it's inside exposed filters option
Question : Does the "Search API" module use the "Search" module of the Drupal core?
Ans : No
Question : What is anonymous user ID?
Ans : 0
Question : In a default multi-site Drupal setup, how the databases are handelled ?
Ans : Each subsite has its own autonomous separate database with no tables sharing at all.
Question : Could I alter all queries in Drupal modules?
Ans : No, only for tagged queries
Question : What data type can I set with the function "variable_set" ?
Ans : String, Integer, Float, Boolean, Array, Object, NULL, Resource
Question : What "field formatters" are conceived for?
Ans : To control how the data is displayed
Question : Is there a way by which a malicious user may be able to know the username of user 1 in a default Drupal 7 environment ?
Ans : Wrong: No, by default nobody is able to know the username of the first user
Wrong: Yes, by going to / user / views / 1 the URL gets rewritten and the 1 number is replaced by the admin username
Correct : Yes, by going to / users / 1 the URL gets rewritten and the 1 number is replaced by the admin username
Wrong: Yes, by going to / user / views / 1 the URL gets rewritten and the 1 number is replaced by the admin username
Correct : Yes, by going to / users / 1 the URL gets rewritten and the 1 number is replaced by the admin username
Question : To make a region hidden, you can:
Ans : use a system_system_info_alter function
Question : With which hook does it possible to modify the exposed filters created by views?
Ans : hook_form_alter
Question : What are . info files and how do I write them?
Ans : . info files are used primarily by the modules administration system for display purposes, as well as providing criteria to control activation and deactivation. These files are required for Drupal to recognize the presence of a module
Question : How should you insert a "placeholder" attribute?
Ans : Using a form alter function
Question : What can happen if you install a node . js module inside a theme?
Ans :
Wrong: Nothing, it will work fine
Wrong: Drupal theme can generate an error, caused by node.js incompatibility with the jQuery.once plugin, resulting in a blank screen
Correct: Drupal theme can generate an error, caused by node.js modules file extensions, resulting in a blank screen
Wrong: Nothing, it will work fine
Wrong: Drupal theme can generate an error, caused by node.js incompatibility with the jQuery.once plugin, resulting in a blank screen
Correct: Drupal theme can generate an error, caused by node.js modules file extensions, resulting in a blank screen
Question : What are Entity Metadata Wrappers?
Ans : They are wrapper classes provided by contrib module Entity that make dealing with the values of an entity's properties and fields easier.
Question : You need to migrate from a datasource that have a compound primary key, how can you store this key into the Migrate Map table?
Ans : The second argument of MigrateSQLMap constructor, $source_key, can be an array and can be use to store the compound source key
Question : With Migrate module, how do I list the fields available for mapping from a source?
Ans : Yes, with drush mfs
Question : D8 will run also on the of Percona database:
Ans : True
Question : Drupal 7 includes a system to avoid loading JQuery on all pages:
Ans :
Wrong: False, only Drupal 8 will do that
Correct: True, but from 7.36 version
Wrong: False, only Drupal 8 will do that
Correct: True, but from 7.36 version
Question : What is EntityFieldquery?
Ans : Wrong: It's a contrib module that lets you retrieve field values from entities passing specified parameters
Wrong: It's a contrib module that lets you attach a special field to entities that grabs params from querystring
Correct: It's a core API that lets you fetch information about entities without the need to build SQL queries
Wrong: It's a contrib module that lets you attach a special field to entities that grabs params from querystring
Correct: It's a core API that lets you fetch information about entities without the need to build SQL queries
Question : In a migration class, is it possible to skip a source row?
Ans : Yes, just return false from prepareRow method
Question : Drupal 7 implements:
Ans : Wrong: its pager with "previous" and "next" links styled using a css ::before pseudo-element Wrong: its pager with optional and custom text attached to "previous" and "next" links Correct: its pager with hardcoded text attached to "previous" and "next" links
Question : What is Composer?
Ans : The dependency manager used by Drush, the Symfony framework, and Drupal 8. It is the preferred means of installing many Drupal based projects
Question : Which hook runs during bootstrap?
Ans : hook_boot
Question : Using Drush to perform a migration, Is it possible to analyze how many resources the process is consuming?
Ans :
Wrong: Yes, you can use the screen command on Linux
Correct: Yes, you can use the --instrument option
Wrong: Yes, you can use the screen command on Linux
Correct: Yes, you can use the --instrument option
Question : What happens when a user decides to delete their account?
Ans : The account settings at Configuration -> Account Settings determine what happens when a user decides to delete the account.The account can be:
- Disabled, but the account content is left online
- Disabled, and all contents are taken offline (unpublished)
- Deleted, and all contents are deleted
- Deleted, and the content is reassigned to the anonymous user
Question : When adding a field with multiple allowed values what is the purpose of using the following syntax?
1 | Option A
2 | Option B
3 | Option C
Ans : This key|value syntax enables you to change the value (for example: Option A) without skewing the results of previously stored values, because both values will be tied to the same key.
Question : How many images can be uploaded using a single image field?
Ans : Every field can be set to allow for multiple values. As an administrator, you can choose to limit image uploads to any value between 1 and 10 or unlimited.
Question : If you want a block to appear only on the blog section at http://localhost/blogs, how would you accomplish this?
Ans : Use the block configuration's Page Specific Visibility Settings to set it to show on only the pages specified and then enter the following under Pages: blogs
blogs / *
blogs / *
Question : Explain the difference between a field type and field widget:
Ans : A field type defines the type of data being stored, such as text, number, date, files or images. A widget is how the data is requested from the user — calendar date-pickers, drop-down selection forms and image upload forms are examples of widgets.
Question : What is an Image style?
Ans : An image style can automatically resize, crop, rotate or desaturate (convert color to black- and-white) uploaded pictures. You can use image styles to create thumbnails, previews or large versions.
Question : Why would you set the Main and Secondary links to the same menu?
Ans : When a Main link is clicked, the child links will appear in the Secondary links area. For example, if the Main link "Add new content" is clicked, the Secondary links will contain a list of content that can be created (Article, Page and so on).
Question : How many regions does a theme have?
Ans : Drupal provides multiple default regions to a theme, such as Left Sidebar, Right Sidebar, Content and so on. A theme, however, has full control over the regions and may have more or fewer regions than the defaults.
Question : How does a private profile field differ from a hidden profile field?
Ans : A private field is entered by the user who is creating the profile and is not visible to the general public. A hidden field is only entered by and visible to user administrators.
Question : The post date of your content is based on what time zone?
Ans : The date and time displayed are determined by the viewing user's configured time zone. If the user has not been granted the permission to modify their time zone or simply has not set their time zone, the site's default time zone will be used. This setting is at Configuration ➪ Regional and Languages ➪ Regional Settings.
Question : What is the difference between an exposed filter and an argument?
Ans : Arguments do not provide a form or method that a user can manipulate to modify the view. Arguments are often used to provide items such as per-user image galleries, tracker pages or categorization pages. Exposed filters provide an easy-to-use form to modify the view in real time.
Question : What permissions are available for Views?
Ans : The Views module has two types of permissions: all-views and per-view. The all-view's Access All Views permission permits access to every view on your site regardless of per-view access controls. Per-view permissions are based on either a user's role or if the user has a certain site permission.
Question : How does the weight system work in Drupal?
Ans : The weight is the order in which the terms appear. For example, a term that is weighted 5 is "lighter" than a term that is weighted 7, so it will float higher. Terms are always ordered first by weight and second alphabetically.
Question : What is the easiest way to increase the performance of your view?
Ans : Turn on Views caching.
Question : What is a search index and when is it created?
Ans : A search index is a catalog of your site's data that is used to match search keywords to their respective content. A search index is updated during each cron run and is limited only by the site's index throttle set at Configuration ➪ Search Settings.
Question : What is the advantage of the Drupal API (Application Programming Interface)?
Ans : When you are writing custom modules or using custom PHP code, you can use the Drupal API to save time and code.
Question : What does the Rule Scheduler do?
Ans : The Rule Scheduler module straightforwardly schedules rule sets, a collection of rules that will be triggered by something other than a system event. This trigger could be custom PHP code or a schedule.
Question : How does block cache differ from page cache?
Ans : Wrong: Block cache stores only the individual blocks on your website, such as the user login block or a navigational menu. A block cache is used for authenticated users. A page cache stores the fully rendered page of your site and is only used for anonymous users.
Question : hook_filter_info()
Ans : This hook is invoked by filter_get_filters() and allows modules to register input filters they provide.
Question : Why is there a separate permission for the advanced search?
Ans : When an advanced search is used, the search query operates more slowly and consumes more system resources.
Question : Why Drupal 8 has a new theme called Classy?
Ans : Because core templates doesn't have any class defined
Question : In Drupal 8 also configuration settings are entities:
Ans : True.
Question : What is the file * . breakpoints . yml in Drupal 8?
Ans : You can use it to define media queries in you custom Theme.
Question : In Drupal 8 also blocks are entities so we can add to them custom field:
Ans : True.
Question : Drupal 8 is fully OOP?
Ans : False.
Question : In Drupal 8 themeable function does not exist anymore. They are all twig templates, a kind of tpl:
Ans : False.
Question : In Drupal 8 we can place the same block in different region in the same page:
Ans : True.
Question : What is used in place of hook_menu() in Drupal 8?
Ans : Functionalities are splitted between hook . links . menu . yml, hook . links . task . yml and hook . routing . yml
Question : Which version of Drush supports Drupal 8?
Ans : Drush 7.
Question : Drupal 8 does provide an upgrade path from a previous version?
Ans : Yes, of course
Question : What is a contrib module?
Ans : A freely usable module furnished by the community
Question : What the command drush sql-cli is used for?
Ans : Opening an SQL shell
Question : How can we use .tpl file in Drupal8?
Ans : .tpl files can be bounded to .twig files to provide usefull informations about variabiles and methods
Question : What is the best approach to use if I want to use a specific css for node--123 . html . twig?
Ans : Towards html . twig uso attach_library(nome_libreria)
Question : It is possible in the File system section to delete orphans file?
Ans : Yes, but it's deleting every non referenced file in one node
Question : In which route property the parameters get inserted to pass to the recall action?
Ans :
Wrong: requirements
Correct: defaults
Wrong: requirements
Correct: defaults
Question : How can I have access in twig to the #markup variable defined as follow $variables['site_slogan']['#markup'] = "..."?
Ans : {{ site_slogan['#markup'] }}
Question : How can I add a library for a specific entity using the pre processing hook_preprocessing_ function?
Ans :
Wrong: $variables['#attached']['library'][] = "nome_libreria"
Correct: $variables['#attached']['libraries'][] = "nome_libreria"
Wrong: $variables['#attached']['library'][] = "nome_libreria"
Correct: $variables['#attached']['libraries'][] = "nome_libreria"
Question : Is there the possibility to enable in the drupal core a module called "responsive image styles"?
Ans :
Wrong: no, it's a contrib module
Correct: yes, it associates preset to defined breakpoint in our website
Wrong: no, it's a contrib module
Correct: yes, it associates preset to defined breakpoint in our website
Question : How do you nullify one or more elements in the Drupal 8 cache?
Ans : \ Drupal \ Core \ Cache \ Cache::invalidateTags(array('node:5', 'my_tag'));
Question : What indicates the property requirements within a route structure?
Ans :
Wrong: Indicating that requested controlled has compulsory parameters controller
Correct: Indicating the conditions that need to be verified to have access to the route
Wrong: Indicating that requested controlled has compulsory parameters controller
Correct: Indicating the conditions that need to be verified to have access to the route
Question : How can I extract an element from the Drupal 8 cache?
Ans :
Wrong: \ Drupal \ Cache::cache()->get('my_value');
Wrong: \ Drupal :: cache()>getInstance()>get('my_value');
Correct: \ Drupal :: cache()->get('my_value');
Wrong: \ Drupal \ Cache::cache()->get('my_value');
Wrong: \ Drupal :: cache()>getInstance()>get('my_value');
Correct: \ Drupal :: cache()->get('my_value');
Add new comment