Monday, 6 June 2016

Lock may available Drupal

How to remove error lock may available in drupal

Drupal showing me an error
includes/database/database.inc on line 2171





open php.ini and my.cnf located on /opt/lampp/etc
find max and change all limits to 1024 and max_execution_time=0

Get field value in Form alter drupal 8

Get field value in Form alter drupal 8



syntax:    $form_state->getValue('machine name');


to get machine name print $form_state->getValue();    // it will show all value of form

$field_e_mail_address=$form_state->getValue('field_e_mail_address');
$emailId=$field_e_mail_address[0]['value'];


Print nid in drupal 8 twig file or template file

print nid in drupal 8 twig file or template file




add this code in  _preprocess_page in .theme file at following location

ryder/themes/theamname/theamname.theme

find for _preprocess_page and add this

    $node = \Drupal::routeMatch()->getParameter('node');
    if ($node) {
      $variables['nodeid'] = $node->id();
    }

now in twig print as {{ nodeid }}