public ViewEditForm::renderDisplayTop(ViewUI $view)
Render the top of the display so it can be updated during ajax operations.
File
- core/modules/views_ui/src/ViewEditForm.php, line 672
Class
- ViewEditForm
- Form controller for the Views edit form.
Namespace
Drupal\views_ui
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | public function renderDisplayTop(ViewUI $view ) { $display_id = $this ->displayID; $element [ '#theme_wrappers' ][] = 'views_ui_container' ; $element [ '#attributes' ][ 'class' ] = array ( 'views-display-top' , 'clearfix' ); $element [ '#attributes' ][ 'id' ] = array ( 'views-display-top' ); // Extra actions for the display $element [ 'extra_actions' ] = array ( '#type' => 'dropbutton' , '#attributes' => array ( 'id' => 'views-display-extra-actions' , ), '#links' => array ( 'edit-details' => array ( 'title' => $this ->t( 'Edit view name/description' ), 'url' => Url::fromRoute( 'views_ui.form_edit_details' , [ 'js' => 'nojs' , 'view' => $view ->id(), 'display_id' => $display_id ]), 'attributes' => array ( 'class' => array ( 'views-ajax-link' )), ), 'analyze' => array ( 'title' => $this ->t( 'Analyze view' ), 'url' => Url::fromRoute( 'views_ui.form_analyze' , [ 'js' => 'nojs' , 'view' => $view ->id(), 'display_id' => $display_id ]), 'attributes' => array ( 'class' => array ( 'views-ajax-link' )), ), 'duplicate' => array ( 'title' => $this ->t( 'Duplicate view' ), 'url' => $view ->urlInfo( 'duplicate-form' ), ), 'reorder' => array ( 'title' => $this ->t( 'Reorder displays' ), 'url' => Url::fromRoute( 'views_ui.form_reorder_displays' , [ 'js' => 'nojs' , 'view' => $view ->id(), 'display_id' => $display_id ]), 'attributes' => array ( 'class' => array ( 'views-ajax-link' )), ), ), ); if ( $view ->access( 'delete' )) { $element [ 'extra_actions' ][ '#links' ][ 'delete' ] = array ( 'title' => $this ->t( 'Delete view' ), 'url' => $view ->urlInfo( 'delete-form' ), ); } // Let other modules add additional links here. \Drupal::moduleHandler()->alter( 'views_ui_display_top_links' , $element [ 'extra_actions' ][ '#links' ], $view , $display_id ); if (isset( $view ->type) && $view ->type != $this ->t( 'Default' )) { if ( $view ->type == $this ->t( 'Overridden' )) { $element [ 'extra_actions' ][ '#links' ][ 'revert' ] = array ( 'title' => $this ->t( 'Revert view' ), 'href' => "admin/structure/views/view/{$view->id()}/revert" , 'query' => array ( 'destination' => $view ->url( 'edit-form' )), ); } else { $element [ 'extra_actions' ][ '#links' ][ 'delete' ] = array ( 'title' => $this ->t( 'Delete view' ), 'url' => $view ->urlInfo( 'delete-form' ), ); } } // Determine the displays available for editing. if ( $tabs = $this ->getDisplayTabs( $view )) { if ( $display_id ) { $tabs [ $display_id ][ '#active' ] = TRUE; } $tabs [ '#prefix' ] = '<h2 class="visually-hidden">' . $this ->t( 'Secondary tabs' ) . '</h2><ul id = "views-display-menu-tabs" class="tabs secondary">' ; $tabs [ '#suffix' ] = '</ul>' ; $element [ 'tabs' ] = $tabs ; } // Buttons for adding a new display. foreach (Views::fetchPluginNames( 'display' , NULL, array ( $view ->get( 'base_table' ))) as $type => $label ) { $element [ 'add_display' ][ $type ] = array ( '#type' => 'submit' , '#value' => $this ->t( 'Add @display' , array ( '@display' => $label )), '#limit_validation_errors' => array (), '#submit' => array ( '::submitDisplayAdd' , '::submitDelayDestination' ), '#attributes' => array ( 'class' => array ( 'add-display' )), // Allow JavaScript to remove the 'Add ' prefix from the button label when // placing the button in a "Add" dropdown menu. '#process' => array_merge ( array ( 'views_ui_form_button_was_clicked' ), $this ->elementInfo->getInfoProperty( 'submit' , '#process' , array ())), '#values' => array ( $this ->t( 'Add @display' , array ( '@display' => $label )), $label ), ); } return $element ; } |
Please login to continue.