Breaking

Followers

Monday, 8 May 2017

Top Drupal Interview Questions

JSON

JSON: JavaScript Object Notation.

JSON is a syntax for storing and exchanging data.

JSON is text, written with JavaScript object notation.

What is html5

HTML5 is a markup language used for structuring and presenting content on the World Wide Web. It is the fifth and current version of the HTML standard.

Sessions
A session is a way to store information (in variables) to be used across multiple pages.



1. Which File Excute First In Drupal 7

ANS:- index.php=>bootstrap.inc=>seesion,cache,database file.

2. What is hook_block_info & hook_block_view

ANS:-
hook_block_info()
This hook declares to Drupal what blocks are provided by your module and can optionally specify initial block configuration settings.

hook_block_view
$delta: Which block to render. This is a unique identifier for the block within the module, defined in hook_block_info().

3. if we have delete the page.tpl.php & node.tpl.php then output rander or not

ANS:- Yes

4. hook_preprocess & hook_preprocess_html

ANS:-
hook_preprocess
Modify drupal theme and create custom variables
hook_preprocess_html
Preprocess variables for html.tpl.php


5. hook_boot & hook_init

HOOK_BOOT :
1. Cached page executes this hook.
2. This hook is run at the beginning of the page request.
3. It happens while Drupal is still in bootstrap mode.

HOOK_INIT:
1. Perform setup tasks for non-cached page requests.
2. This hook is run at the beginning of the page request.
3. It happens after bootstrap mode.

6. how to make configuration menu in module using custome module.

ANS:-
Add custom.info
configure = admin/config/nirvana/nirvana-notification-mail

7. Menu callback & menu_local_task different

MENU_CALLBACK
Menu type -- A hidden, internal callback, typically used for API calls.

MENU_DEFAULT_LOCAL_TASK
Menu type -- The "default" local task, which is initially active.

MENU_LOCAL_ACTION
Menu type -- An action specific to the parent, usually rendered as a link.

MENU_LOCAL_TASK
Menu type -- A task specific to the parent item, usually rendered as a tab.
MENU_NORMAL_ITEM
Menu type -- A "normal" menu item that's shown in menu and breadcrumbs.

MENU_SUGGESTED_ITEM
Menu type -- A normal menu item, hidden until enabled by an administrator.

8. When cache load in drupal

ANS:- After bootstrap.inc file

9. How to initilize cache on a particilar node like node-5

ANS:- Use hookinit and hook_boot

drupal_flush_all_caches()

10. What use file attachment in views

ANS:- The Attachment option is to create yet another view that you can attach before and/or after any of the displays on your current view.

12. How to trigger a mail without cron job

13. how to remove js

ANS:-
function MYTHEME_js_alter(&$javascript) {
if ($some_condition) {
unset($javascript['path/to/script.js']);
}
}

14. how to add js without using drupal_add_js & info file and Drupal behaviour

ANS:-
$form['#attached']['css'] = array(
drupal_get_path('module', 'ajax_example') . '/ajax_example.css',
);

$form['#attached']['js'] = array(
drupal_get_path('module', 'ajax_example') . '/ajax_example.js',
);

Drupal.behaviors.infiniteScrollAddClass = {
attach: function (context, settings) {
$('.view-display-id-page .views-row').addClass('fancy-pants');
}
};

15. if we have created two hook_form_alter in drupal for same form in different module. Then which form_alter excute first.

ANS:- According to alphabatic (like A,B,C)

16. How to alter views expose form

ANS:- Hook_form_alter and Hook_view_query_alter

17. How add custome query in views query alter

ANS:- Hook_view_query_alter

18. Diff between fetch_assoc, fetch_field, fetch_all


Primary Key
Primary key cannot have a NULL value.
Each table can have only one primary key.
Primary key supports Auto Increment value.

Unique Key
Unique Constraint may have a NULL value.
Each table can have more than one Unique Constraint.
Unique Constraint doesn't supports Auto Increment value.

Foreign Key
Foreign key is a field in the table that is Primary key in another table.
Foreign key can accept multiple null value.
-->
We can have more than one foreign key in a table.

19. Field API   

The Field API allows custom data fields to be attached to Drupal entities and takes care of storing, loading, editing, and rendering field data. Any entity type (node, user, etc.)

20. Drupal layer

1) Date (Node etc.)
2) Module
3) Block and menu
4) USer permission
5) Template
 

21. Diff between bundle and node

Examples:

Entity type: Nodes (content), Comments, Taxonomy terms, User profiles

Bundle names: Pages, Articles, Blog Posts (Note: Not all entity types have bundles)


22. How much layer is there in Drupal 

ANS:- There are five main layers to consider:





  1. At the base of the system is the collection of nodes—the data pool. Before anything can be displayed on the site, it must be an input as data.
  2. The next layer up is where modules live. Modules are functional plugins that are either part of the Drupal core (they ship with Drupal) or they are contributed items that have been created by members of the Drupal community. Modules build on Drupal's core functionality, allowing you to customize the data items (fields) on your node types; set up e-commerce; programmatically sorting and display of content (custom output controlled by filters you define); and more. There are thousands of different options within the fast-growing repository of contributed Drupal modules. They represent the innovation and collaborative effort of everyone from individuals to large corporations.
  3. At the next layer, we find blocks and menus. Blocks often provide the output from a module or can be created to display whatever you want, and then can be placed in various spots (Regions) in your template (theme) layout. Blocks can be configured to output in various ways, as well as only showing on certain defined pages, or only for certain defined users. Menus are navigators in Drupal, which define the content coming on each defined menu path (relative URL). Menus are a core element of Drupal which provide links to all the pages created in Drupal.
  4. Next are user permissions. This is where settings are configured to determine what different kinds of users are allowed to do and see. Permissions are defined for various roles, and in turn, users are assigned to these roles in order to grant them the defined permissions.
  5. On the top layer is the site theme (the "skin"). This is made up predominantly of XHTML and CSS, with some PHP variables intermixed, so Drupal-generated content can go in the appropriate spots. Also included with each theme is a set of functions that can be used to override standard functions in the modules in order to provide complete control over how the modules generate their markup at output time. Templates can also be assigned on-the-fly based on user permissions.

No comments:

Post a Comment