Uncategorized

How to use views in Drupal 8

Step 1: Go to Manage >> Structure >> Views >> click on +Add new view

admin_structure_page

 

add_a_view

Step 2: Clicking on +Add new view redirects to “Add new view” page.
The page has View Basic information fieldset that contain View name and Description.

Section 2 has VIEW SETTING which has option to  show, type, and sorted by.
Where, Show means what would you like to Display, Comment, Log entries, Files, Content, Content revision, Taxonomy Terms, Users, Link Count, Custom block revision or Custom block.

Of type holds bundle type either Article, Basic page, custom content type or All.
Sorted by – How do you wants to sort? Sorting by Newest first, Oldest first, or by title; these are the initial level sorting options. Later on you will get more and more sorting criteria e.g.: by author name.

creating_view

The Addition of new view also carries PAGE SETTINGS & BLOCK SETTINGS.
Once you check on “Create a page”, this will open up page configuration section which, includes page title, page path, Display format, item to be displayed, with three additional option.

  • use a pager.
  • create a menu link &
  • include an RSS feed.

view_page_settings

Checking the block setting Will allow you to create a “view block”. This section has option to update Block title, Block Display settings, items per block with pagination option.

view_block_settings

Once you are done with filling up these fields value. click on save and edit button. i’m creating view page and view block both in in this example.

view_page_with_view_block_info

Step 3: Once you have saved the view page data, page will be redirected to view Display configuration section having page and block UI.

Just like Drupal 7 views contrib module, Drupal 8 views also has similar UI.

As we can see here view has multiple configuration.

Title : set the title for view page.
Format: How data has to be displayed on the site.
Fields: what are  fields you would like to display.
Filter criteria: allow filter by type as well as option to  expose the same.
Sort criteria:  sorting of field date ascending or descending manner.
page Settings: set the page path, assign to menu if required, view permission.
Header: custom header for the view page.
Footer: custom footer for the view page.
No Result Behaviour: In case if view query fetches no data or empty set, we can set option to override and display custom message to user e.g. no search result available, please try again.
Pager: allow site to create pagination on view page.
Advanced: As the label suggest, this section has advanced  options like CONTEXTUAL FILTERS , RELATIONSHIPS, EXPOSED FORM, OTHER etc.

You can check my previous blog post on how to use contextual filters in Drupal 8 for mode details.

views_contextual_filterNow, let’s start with view page configuration.

We will add a filter to display only content from news.

To add a filter go to FILTER CRITERIA section and click on Add button. This will show pop up box, where you can search by Type or search by name. As we are filtering based on content type this can be done in two ways –

  1.  Select Content in Type dropdown and search for Type.
  2.  Write type in Search box and select appropriate.

Select the checkbox next to Type and click on Apply (all displays).
view_filter

 

Visit website 2501
Visit website 2502
Visit website 2503
Visit website 2504
Visit website 2505
Visit website 2506
Visit website 2507
Visit website 2508
Visit website 2509
Visit website 2510
Visit website 2511
Visit website 2512
Visit website 2513
Visit website 2514
Visit website 2515
Visit website 2516
Visit website 2517
Visit website 2518
Visit website 2519
Visit website 2520
Visit website 2521
Visit website 2522
Visit website 2523
Visit website 2524
Visit website 2525
Visit website 2526
Visit website 2527
Visit website 2528
Visit website 2529
Visit website 2530
Visit website 2531
Visit website 2532
Visit website 2533
Visit website 2534
Visit website 2535
Visit website 2536
Visit website 2537
Visit website 2538
Visit website 2539
Visit website 2540
Visit website 2541
Visit website 2542
Visit website 2543
Visit website 2544
Visit website 2545
Visit website 2546
Visit website 2547
Visit website 2548
Visit website 2549
Visit website 2550
Visit website 2551
Visit website 2552
Visit website 2553
Visit website 2554
Visit website 2555
Visit website 2556
Visit website 2557
Visit website 2558
Visit website 2559
Visit website 2560
Visit website 2561
Visit website 2562
Visit website 2563
Visit website 2564
Visit website 2565
Visit website 2566
Visit website 2567
Visit website 2568
Visit website 2569
Visit website 2570
Visit website 2571
Visit website 2572
Visit website 2573
Visit website 2574
Visit website 2575
Visit website 2576
Visit website 2577
Visit website 2578
Visit website 2579
Visit website 2580
Visit website 2581
Visit website 2582
Visit website 2583
Visit website 2584
Visit website 2585
Visit website 2586
Visit website 2587
Visit website 2588
Visit website 2589
Visit website 2590
Visit website 2591
Visit website 2592
Visit website 2593
Visit website 2594
Visit website 2595
Visit website 2596
Visit website 2597
Visit website 2598
Visit website 2599
Visit website 2600
Visit website 2601
Visit website 2602
Visit website 2603
Visit website 2604
Visit website 2605
Visit website 2606
Visit website 2607
Visit website 2608
Visit website 2609
Visit website 2610
Visit website 2611
Visit website 2612
Visit website 2613
Visit website 2614
Visit website 2615
Visit website 2616
Visit website 2617
Visit website 2618
Visit website 2619
Visit website 2620
Visit website 2621
Visit website 2622
Visit website 2623
Visit website 2624
Visit website 2625
Visit website 2626
Visit website 2627
Visit website 2628
Visit website 2629
Visit website 2630
Visit website 2631
Visit website 2632
Visit website 2633
Visit website 2634
Visit website 2635
Visit website 2636
Visit website 2637
Visit website 2638
Visit website 2639
Visit website 2640
Visit website 2641
Visit website 2642
Visit website 2643
Visit website 2644
Visit website 2645
Visit website 2646
Visit website 2647
Visit website 2648
Visit website 2649
Visit website 2650
Visit website 2651
Visit website 2652
Visit website 2653
Visit website 2654
Visit website 2655
Visit website 2656
Visit website 2657
Visit website 2658
Visit website 2659
Visit website 2660
Visit website 2661
Visit website 2662
Visit website 2663
Visit website 2664
Visit website 2665
Visit website 2666
Visit website 2667
Visit website 2668
Visit website 2669
Visit website 2670
Visit website 2671
Visit website 2672
Visit website 2673
Visit website 2674
Visit website 2675
Visit website 2676
Visit website 2677
Visit website 2678
Visit website 2679
Visit website 2680
Visit website 2681
Visit website 2682
Visit website 2683
Visit website 2684
Visit website 2685
Visit website 2686
Visit website 2687
Visit website 2688
Visit website 2689
Visit website 2690
Visit website 2691
Visit website 2692
Visit website 2693
Visit website 2694
Visit website 2695
Visit website 2696
Visit website 2697
Visit website 2698
Visit website 2699
Visit website 2700
Visit website 2701
Visit website 2702
Visit website 2703
Visit website 2704
Visit website 2705
Visit website 2706
Visit website 2707
Visit website 2708
Visit website 2709
Visit website 2710
Visit website 2711
Visit website 2712
Visit website 2713
Visit website 2714
Visit website 2715
Visit website 2716
Visit website 2717
Visit website 2718
Visit website 2719
Visit website 2720
Visit website 2721
Visit website 2722
Visit website 2723
Visit website 2724
Visit website 2725
Visit website 2726
Visit website 2727
Visit website 2728
Visit website 2729
Visit website 2730
Visit website 2731
Visit website 2732
Visit website 2733
Visit website 2734
Visit website 2735
Visit website 2736
Visit website 2737
Visit website 2738
Visit website 2739
Visit website 2740
Visit website 2741
Visit website 2742
Visit website 2743
Visit website 2744
Visit website 2745
Visit website 2746
Visit website 2747
Visit website 2748
Visit website 2749
Visit website 2750
Visit website 2751
Visit website 2752
Visit website 2753
Visit website 2754
Visit website 2755
Visit website 2756
Visit website 2757
Visit website 2758
Visit website 2759
Visit website 2760
Visit website 2761
Visit website 2762
Visit website 2763
Visit website 2764
Visit website 2765
Visit website 2766
Visit website 2767
Visit website 2768
Visit website 2769
Visit website 2770
Visit website 2771
Visit website 2772
Visit website 2773
Visit website 2774
Visit website 2775
Visit website 2776
Visit website 2777
Visit website 2778
Visit website 2779
Visit website 2780
Visit website 2781
Visit website 2782
Visit website 2783
Visit website 2784
Visit website 2785
Visit website 2786
Visit website 2787
Visit website 2788
Visit website 2789
Visit website 2790
Visit website 2791
Visit website 2792
Visit website 2793
Visit website 2794
Visit website 2795
Visit website 2796
Visit website 2797
Visit website 2798
Visit website 2799
Visit website 2800
Visit website 2801
Visit website 2802
Visit website 2803
Visit website 2804
Visit website 2805
Visit website 2806
Visit website 2807
Visit website 2808
Visit website 2809
Visit website 2810
Visit website 2811
Visit website 2812
Visit website 2813
Visit website 2814
Visit website 2815
Visit website 2816
Visit website 2817
Visit website 2818
Visit website 2819
Visit website 2820
Visit website 2821
Visit website 2822
Visit website 2823
Visit website 2824
Visit website 2825
Visit website 2826
Visit website 2827
Visit website 2828
Visit website 2829
Visit website 2830
Visit website 2831
Visit website 2832
Visit website 2833
Visit website 2834
Visit website 2835
Visit website 2836
Visit website 2837
Visit website 2838
Visit website 2839
Visit website 2840
Visit website 2841
Visit website 2842
Visit website 2843
Visit website 2844
Visit website 2845
Visit website 2846
Visit website 2847
Visit website 2848
Visit website 2849
Visit website 2850
Visit website 2851
Visit website 2852
Visit website 2853
Visit website 2854
Visit website 2855
Visit website 2856
Visit website 2857
Visit website 2858
Visit website 2859
Visit website 2860
Visit website 2861
Visit website 2862
Visit website 2863
Visit website 2864
Visit website 2865
Visit website 2866
Visit website 2867
Visit website 2868
Visit website 2869
Visit website 2870
Visit website 2871
Visit website 2872
Visit website 2873
Visit website 2874
Visit website 2875
Visit website 2876
Visit website 2877
Visit website 2878
Visit website 2879
Visit website 2880
Visit website 2881
Visit website 2882
Visit website 2883
Visit website 2884
Visit website 2885
Visit website 2886
Visit website 2887
Visit website 2888
Visit website 2889
Visit website 2890
Visit website 2891
Visit website 2892
Visit website 2893
Visit website 2894
Visit website 2895
Visit website 2896
Visit website 2897
Visit website 2898
Visit website 2899
Visit website 2900
Visit website 2901
Visit website 2902
Visit website 2903
Visit website 2904
Visit website 2905
Visit website 2906
Visit website 2907
Visit website 2908
Visit website 2909
Visit website 2910
Visit website 2911
Visit website 2912
Visit website 2913
Visit website 2914
Visit website 2915
Visit website 2916
Visit website 2917
Visit website 2918
Visit website 2919
Visit website 2920
Visit website 2921
Visit website 2922
Visit website 2923
Visit website 2924
Visit website 2925
Visit website 2926
Visit website 2927
Visit website 2928
Visit website 2929
Visit website 2930
Visit website 2931
Visit website 2932
Visit website 2933
Visit website 2934
Visit website 2935
Visit website 2936
Visit website 2937
Visit website 2938
Visit website 2939
Visit website 2940
Visit website 2941
Visit website 2942
Visit website 2943
Visit website 2944
Visit website 2945
Visit website 2946
Visit website 2947
Visit website 2948
Visit website 2949
Visit website 2950
Visit website 2951
Visit website 2952
Visit website 2953
Visit website 2954
Visit website 2955
Visit website 2956
Visit website 2957
Visit website 2958
Visit website 2959
Visit website 2960
Visit website 2961
Visit website 2962
Visit website 2963
Visit website 2964
Visit website 2965
Visit website 2966
Visit website 2967
Visit website 2968
Visit website 2969
Visit website 2970
Visit website 2971
Visit website 2972
Visit website 2973
Visit website 2974
Visit website 2975
Visit website 2976
Visit website 2977
Visit website 2978
Visit website 2979
Visit website 2980
Visit website 2981
Visit website 2982
Visit website 2983
Visit website 2984
Visit website 2985
Visit website 2986
Visit website 2987
Visit website 2988
Visit website 2989
Visit website 2990
Visit website 2991
Visit website 2992
Visit website 2993
Visit website 2994
Visit website 2995
Visit website 2996
Visit website 2997
Visit website 2998
Visit website 2999
Visit website 3000

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button