1

I have a survey form created with webform module.i have to display all survey form title with submissions and without submissions with webform category on home page.but it displaying only submitted survey forms title.how can i display webform title with zero submission in drupal8?

2 Answers 2

3
$webform = \Drupal::entityTypeManager()->getStorage('webform')->load('my_form');
$title = $webform->label();
0

use below code as a function in your module file and call it on your custom block.

  function module_name_webformtitle(){
    $query = Drupal::service('entity.query')->get('webform');
    $query->condition('category', 'survey_name');//your survey name
    $entity_ids = $query->execute();
    $webform_id=array();
     foreach($entity_ids as $webid){
       $webform_id[]=$webid;     
     }
    $webform = Webform::loadMultiple($webform_id);
     foreach($webform as $webforms){
        $webformtitle=$webforms->get('title');
    }
  }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.