Saturday, November 17, 2018

Customization in drupal 8 core contact form using form alter

How to change Drupal 8 Core Contact form fleld label :-

 If you want to change Contact form "Message" field label you can use "hook_form_alter" .

either you can create a custom module or either you can add form alter in your theme file also.

 
function your_theme_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
       if ($form_id == 'contact_message_feedback_form') {
        $form['message']['widget'][0]['value']['#title'] = t("My Custom Body Label");
     }
} 


Add placeholder in default search using form alter

function your_theme_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
    if (in_array($form_id, ['search_block_form', 'search_form'])) {
        $form['keys']['#attributes']['placeholder'] = t('Search...');
    }
   }if ($form_id == 'contact_message_feedback_form') {
  $form['actions']['submit']['#value'] = t("My Altered submit button text here");
  $form['subject']['widget'][0]['value']['#title'] = t ("My Altered title here");
  $form['message']['widget'][0]['value']['#title'] = t("My custom body text here");
        //$form['message']['widget'][0]['value']['#title'] = t("My Custom Body Label");
  $form['#suffix'] = "<div class='extra-text'><p>Show some text before the comment form.</p></div>";
     }
} 

Friday, November 2, 2018

Create Instances at AWS (Amezon Web services) and connect through SSH.

Step 1: Login your AWS Account.

Step 2: At the navigation click on services, and select "EC2".

Step 3 : If you want to create new site or application or Instance, you need to click on "launch Instances".

Step 4: There is a option for free and paid server for creating instances. ("Choose an Awazon Machine Image (AMI)")

Note : Amazon web services provide you 8 TB space if you want more than it you need to select paid server.

Step 5 : Go through all the steps, there is a option of create key pair, it will use to connect your AWS website with ssh, but remember on thing you can create a pair key only one time and if another user want to access this folder you have to share your pair key.

eg. test.pem file



Step 6 : Connect instances using ssh and pem file

download your pem file and put this at your desktop and connect through ssh username and password.





Step 7 : you need to give the permission of your pem file to read and write.

$ chmod 400 test.pem


Step 8 : SSH Command :

ssh -i YOUR_PEMFILE.pem user@publicdns/domainname

ex - ssh -i xyz.pem ec2-user@ec2-45-415-458.compute-1.amazonaws.com

 
Step 9 : Now you will connect to your AWS Account :)

Step 10 : At AWS account click on your instances, below you will find description tab under that public DNS(IPv4)  ec2-45-415-458.compute-1.amazonaws.com, click on that link you will redirect your web page of your instances.