1. Which of the following is the correct way to get the current theme path in Drupal?
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
$current_delta = get_current_delta($node_type_A->vid);
$node_type_A->field_type_B_node_ref += array($current_delta + 1 => array(‘nid’ => $node_type_B_nid));
$node_type_A = node_submit($node_type_A);
node_save($node_type_A);
content_insert($node_type_A);
Which of following statements are true about code above?
Answers:
Answers:
function custom_module_menu_alter(&$items) {
$items[‘xyx/abc’][‘page callback’] = ‘custom_module_showcontent’;
}
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
if (!empty($breadcrumb)) {
array_shift($breadcrumb);
return ‘<div class=”breadcrumb”>’. implode(‘ › ‘, $breadcrumb) .'</div>’;
}
}
Which of the statement(s) about the code above is/are true?
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
not a key used to register a path in hook_menu()?
Answers:
if ($form_id == ‘user_register’ && ‘user’ == arg(0) && ‘register’ == arg(1)) {
// snipped alteration code
}
}
Which of the following statements about code above are true?
Answers:
Answers:
Answers:
Answers:
Answers:
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$db_result = db_query(‘SELECT * FROM {users}’);
while($user_object = db_fetch_object($db_result)){
// .. code here
}
Which of the following statement(s) about the above code is/are true?
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
http://example.com/blog/odesk-skills-test?page=1#comment-123
The above URL path is an alias of the following URL path:
http://example.com/node/8
What would be the output of the following code? (Assume it’s placed in the node.tpl.php file)
$arg_0 = arg(0);
var_export($arg_0);
Answers:
Answers:
- drupal_get_path()
- path_to_theme()
- theme_path()
- drupal_get_path() without the variables.
Answers:
- Setting the page cache lifetime minimum to 1 minute
- Enabling CSS and JavaScript aggregation
- Sorting and filtering by CCK fields
- Using a PHP opcode cache
Answers:
- Using panels
- Using a .tpl.php file specificially for that page
- Build page with exact HTML structure you want
- None of above
Answers:
- module_invoke_all()
- module_invoke_hook()
- module_hook_invoke()
- hook_invoke_all()
Answers:
- Development speed – creating a View will be faster than creating a custom module most of the time
- Performance – Views offer increased performance over custom modules
- Maintenance – Views is a Drupal standard, as opposed to using custom modules, which gives your site’s maintenance an unnecessary learning curve
- Upgrading – Views provide an upgrade path to future versions of Drupal, which custom modules don’t provide out-of-the-box
Answers:
- PAC: Presentation-Abstraction-Control
- MVC: Model-View-Controller
- MVVM: Model-View-ViewModel
- SOA: Service-Oriented Architecture
Answers:
- node_save()
- node_insert_image()
- node_create()
- node_load()
Answers:
- By using the drupal_get_css() & drupal_add_css() function
- By using the drupal_attach_css() & drupal_remove_css() function
- By placing the <style > tag in the theme, and placing an overwrite to all classes and IDs that need to be removed
- Core CSS files cannot be removed and custom CSS files cannot be added to a theme
Answers:
- using cache
- using memcahe
- using APC
- using base theme
Answers:
- By using views module to create a block, and configuring a view to take an argument as user ID and set that block to show only on profile pages
- By enabling the node created by users options from the admin panel
- By installing & configuring the related posts module of drupal
- It is a default feature of Drupal to show recent posts created by the user on their profile
Answers:
- menu_alter()
- form_alter()
- A & B both
- None of above
Answers:
- By creating a node-contentname.tpl.php or views-view-field–viewname–field-name-value.tpl.php
- By creating views-view-field–viewname–field-name-value.tpl.php
- Using Semantic Views
- Clicking on admin/build/views/edit/ViewName -> Basic Settings -> Theme
Answers:
- By using the Apache Solr module
- By using the Search Lucene API
- By patching the core modules
- By using all of the above methods
Answers:
- Using check_markup()
- You can only apply filters one at time in your code.
- Using apply_filter()
- Using input_filter()
Answers:
- Can insert a block to a template programmatically using block_invoke().
- Can insert a block to a template programmatically using module_invoke().
- Can insert a block to a template programmatically using module_invoke() and block_invoke().
- Cannot insert a block to a template programmatically.
Answers:
- Creating two files named node-taxonomy.tpl.php and page-taxonomy-term.tpl.php for theming the taxonomy pages
- Adding CSS in the default style in the drupal theme
- Adding code to the template.php file
- Adding the CSS to the taxonomy pages
Answers:
- Values of trans need to be string or integer values; if any other type is there, then a warning will be fired
- The array flip function can also flip the nested array also
- It should use array for the ID which are passed
- Pass only values in the string rather than the array itself
Answers:
- By using Ajax we can pull the data from the node, and using the convention mysite.com/node/1?ajax=1 to view the content
- By implementing both hook_preprocess_page and hook_preprocess_html
- By implementing hook_theme_registry_alter
- Placing a phptemplate_views_view_unformatted_VIEWNAME call in template.php
Answers:
- drush -l http://yoursitename.com/ pm-disable theme_name
- drush -l http://yoursitename.com/ pm-enable theme_name
- drush -l http://yoursitename.com/ vset theme_default theme_name
- drush –l http://yoursitename.com/ settheme theme_name
Answers:
- drush vset site_offline 1
- drush vdel site_offline
- drush vset maintenance_mode 0
- drush setoffline 1
Answers:
- path_to_theme()
- drupal_get_path
- global $theme_path
- All of above
Answers:
- by using hook_views_data() & hook_views_api()
- by using the filefield_stats module
- by using the viewsmodule_stats module
- by using a built-in feature of the Views module, “expose filter”
Answers:
- Use the meta data associated with node type to search the nodes
- Taxonomy terms can be used to filter the search result
- Build the search query on the fly by selecting different and multple meta data
- All of above
Answers:
- yourThemeName_preprocess_content_field_value(&$variables)
- yourThemeName_preprocess_content_field(&$variables)
- yourThemeName_preprocess_content_field_field_tramission_make_model(&$variables)
- yourThemeName_preprocess_content_field_field_tramission_make_model()
Answers:
- By using the node preprocess function and adding the CSS and JavaScript files in the function
- By using the direct drupal function to add the CSS and JavaScript in the body section itself
- By using the drupal_get_css(); and drupal_get_js(); functions
- By creating particular page for that node and using CSS and JavaScript in that page only
Answers:
- drupal_get_destination() is used to get the path.
- $link = url($path, array(‘absolute’ => TRUE));
- global $base_root; $base_root . request_uri();
- $current_url = ‘http://’ .$_SERVER[‘HTTP_HOST’] .$_SERVER[‘REQUEST_URI’];
Answers:
- Drupal.behaviors can be fired multiple times during page execution .
- Modules could override or extend existing Drupal.behaviors.
- Drupal.behaviors can be run whenever new DOM elements are inserted into the document.
- Drupal.behaviors increase jQuery performence.
Answers:
- drush sqlq “update {users} set pass=md5(‘new_password_here’) where uid=1”
- drush user-password someuser –password=”new_password_here”
- Both A & B
- Cannot reset a user’s password using Drush from the command-line
Answers:
- By using the Install Profile module
- By using the Features and Strongarm Module
- By using the svn:externals property
- By using the CCK and Views module
Answers:
- There is no option to set an absolute date as the default value in a CCK date field
- By using strtotime() in date field with exact date
- By using the date picker to select exact date
- By going to the configuration page of the CCK datetime module
Answers:
- Drupal.behaviors can be fired multiple times during page execution .
- Modules could override or extend existing Drupal.behaviors.
- Drupal.behaviors can be run whenever new DOM elements are inserted into the document.
- Drupal.behaviors increase jQuery performence.
Answers:
- Using module_hook_block hook with $delta
- Setting an option from the Drupal admin block page for any module
- Creating a separate module for blocks
- Manually updating drupal_block table to the number of blocks
Answers:
- Any module that has more than ~50 lines of code for page handler functions should be split off into multiple files
- Page include files should be named in the form, modulename.key.inc
- Splitting page handlers into separate files; for example, example.admin.inc and example.pages.inc
- Consolidating page handlers in to a single file, to decrease overhead
$current_delta = get_current_delta($node_type_A->vid);
$node_type_A->field_type_B_node_ref += array($current_delta + 1 => array(‘nid’ => $node_type_B_nid));
$node_type_A = node_submit($node_type_A);
node_save($node_type_A);
content_insert($node_type_A);
Which of following statements are true about code above?
Answers:
- Appending a node reference
- Arranging fields by weight
- Retrieving node refrece from a node
- Saving node without modification
Answers:
- Updating the module’s weight in the system table
- From the Drupal admin panel module page
- Execution order of Drupal modules can not be changed, it’s always in alphabetical order
- Using the _preprocess_node() hook of the particular module
function custom_module_menu_alter(&$items) {
$items[‘xyx/abc’][‘page callback’] = ‘custom_module_showcontent’;
}
Answers:
- The code adds a function which will be called upon requesting path xyx/abc.
- The code adds a function which will be called with function callback queue upon requesting xyx/abc.
- The code is adding a variable to menu path xyx/abc.
- The code is adding a variable to the variable queue of path xyx/abc.
Answers:
- Migrating content from one Drupal website to another
- Exporting modules’ functionality in a single feature module
- Exporting website settings
- Backing up of website and database
Answers:
- By changing the $maintance_mode variable in the settings.php file to FALSE.
- By changing the “Site status” configuration in admin settings to “online”.
- By removing the maintenance-lock.php file from the root of the Drupal installation folder.
- By granting “access site” permissions to anonymous users.
Answers:
- Use function drupal_add_js
- Use function drupal_add_html
- Modify your theme’s page.tpl file
- Modify your theme’s footer.php file
Answers:
- When implicit ‘ownership’ via author tracking is needed
- When categorization via taxonomy is needed
- When implicit tracking of creation/modification time is needed
- When high data integrity is needed
Answers:
- It performs the necessary alterations to the JavaScript code before it is presented on the page.
- It performs the necessary alterations to the JavaScript code after it is presented on the page.
- It performs the necessary alterations to the JavaScript code before the page is loaded by browser.
- It performs the necessary alterations to the JavaScript code after the page is loaded by browser.
if (!empty($breadcrumb)) {
array_shift($breadcrumb);
return ‘<div class=”breadcrumb”>’. implode(‘ › ‘, $breadcrumb) .'</div>’;
}
}
Which of the statement(s) about the code above is/are true?
Answers:
- The code will add one item to the breadcrumbs
- The code will remove the home item from the breadcrumbs
- The code will add one item at the end of the breadcrumbs
- The code will add a separator to the breadcrumbs
Answers:
- Install Path auto module and configure the special characters that you want to allow in the URL.
- Install User Link module.
- Enable in the admin settings.
- Can not do this in Drupal.
Answers:
- Using the arg() function
- $node->currentNid
- $page->nid
- $_SERVER [‘REQUEST_URI’]
Answers:
- Overriding the views-view-field.tpl file
- Overriding the views-view.tpl.php file
- Selecting “rewrite output” and placing the field token values together in the desired display form
- Using the field formatter
Answers:
- By using the drupal_add_css() function
- Using the <link> HTML tag
- Using the <style> HTML tag
- You cannot add custom CSS rules to Drupal pages
Answers:
- By using the devel module
- By using the view_query_export module
- By using $view->build_info[‘query’]
- By using the views_get_current_view() function
Answers:
- drupal_get_form(‘custom1_default_form’,$arg1,$arg2)
- drupal_get_form(‘custom1_default_form’, array(‘arg1’=>’value’,’arg2’=>’value’))
- drupal_get_form(‘custom1_default_form’,$arg1.$arg2)
- we cannot pass arguments to drupal_get_form core function
Answers:
- By enabling Profile module. This module allows for fields to be added to users like first-name and last-name.
- Must enable the User Details module.
- Can not do this for Drupal users.
- A and B
not a key used to register a path in hook_menu()?
Answers:
- file
- file path
- tab_root
- rule
if ($form_id == ‘user_register’ && ‘user’ == arg(0) && ‘register’ == arg(1)) {
// snipped alteration code
}
}
Which of the following statements about code above are true?
Answers:
- The code will alter the registration form for specific user types.
- The code alter the registration form for all instances of the user_register form.
- The code alter the registration form, but only when the user_register form appears on the ‘register/user’ page.
- The code will alter the registration form, but only when the user_register form appears on the ‘user/register’ page.
Answers:
- Fields, Row style output, Style output, Display output
- Display output, Fields, Style output, Row style output
- Fields ,Row style output, Row style output, Display output
- Display output, Style output, Row style output, Fields
Answers:
- Using hook_validate
- Adding $form[‘#validate’][] and writing the validation function
- Using hook_check
- Such elements cannot be validated
Answers:
- By changing the Drupal admin settings’ Site Information page
- By changing it in the php.ini file
- By installing the SMTP module.
- By changing super user account’s email address (user/1); the super user’s email address will be used as the site-wide email authoring address.
Answers:
- taxonomy_get_vocabularies
- taxonomy_vocabulary_load
- taxonomy_load_vocabularies
- taxonomy_vocabulary_get
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$db_result = db_query(‘SELECT * FROM {users}’);
while($user_object = db_fetch_object($db_result)){
// .. code here
}
Which of the following statement(s) about the above code is/are true?
Answers:
- The code can be written in the theme template.php file to fetch all users
- The code won’t run correctly; drupal_bootstrap can’t run from an external script file
- The code can be used in a custom module script to fetch all users
- The code can be used in an external PHP file to fetch all users
Answers:
- By installing the Subdomain module and its required modules.
- By creating a new folder in the ‘sites’ folder with the new domain name as folder name. Then, copy the sites/default/default.settings.php file to the new folder. Run the install.php script from the browser afterwards.
- By adding the new site domain name as a key in the ‘$db_url’ associative array in the settings.php file.
- A single Drupal code base cannot be used to host multiple sites.
Answers:
- By using the Rules module and adding and configuring a new Triggered Rule.
- By installing the Computed Field module and creating a Computed Field as the changing field.
- By implementing the hook_nodeapi hook in a custom module.
- By implementing the hook_node_info hook in a custom module.
Answers:
- Use hook_nodeapi and inside the insert handler add the code that you want to run after node creation. Code below: function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { switch ($op) { case ‘insert’: // Add you code here break; } }
- Can do this in the node settings and add the code there.
- In the admin settings, add in the code that must be ran when the new node is done.
- B and C are correct.
Answers:
- Select “exclude from display” and use token values to display fields
- Select “Trim this field to a maximum length” and put the number of characters
- Select “rewrite output” and write a PHP function for the maximum length
- Use the maximum field formatter to restrict the character length
Answers:
- It’s not necessary to apply database updates manually. Database updates will be applied during automatic maintenance (cron).
- Run the update.php script as soon as the previous version is replaced with the new version.
- Disable the module and enable it again. New database updates will be applied when the module is being enabled.
- Run the db-updates.php file.
Answers:
- By adding “%@example.org” as an email restriction in the Access Rules administration settings
- By installing a Captcha module and its required modules
- By creating a custom module and implementing the hook_user_restrictions hook
- By installing the Domain Access module and its dependencies
Answers:
- Yes, just like any other files.
- No, it would be a security risk if it is allowed, what is does is change the type of the file to .txt
- No, can not upload files in Drupal.
- A and B are correct.
Answers:
- Yes. Bootstrap Drupal functions in your external PHP file.
- Yes. Just place the file inside the root directory of your Drupal installation.
- No.
- A and B are correct.
http://example.com/blog/odesk-skills-test?page=1#comment-123
The above URL path is an alias of the following URL path:
http://example.com/node/8
What would be the output of the following code? (Assume it’s placed in the node.tpl.php file)
$arg_0 = arg(0);
var_export($arg_0);
Answers:
- ‘1’
- ‘node’
- ‘blog’
- ‘blog/odesk-skills-test’
No comments:
Post a Comment