WPDKView::display PHP Method

display() public method

Display the HTML markup content for this view.
public display ( ) : string
return string
    public function display()
    {
        $classes = WPDKHTMLTag::classInline($this->class);
        $style = WPDKHTMLTag::styleInline($this->style);
        $data = WPDKHTMLTag::dataInline($this->data);
        ?>
    <div data-type="wpdk-view"
         style="<?php 
        echo $style;
        ?>
"
         id="<?php 
        echo $this->id;
        ?>
"
         <?php 
        echo $data;
        ?>
         class="<?php 
        echo $classes;
        ?>
">

    <?php 
        /**
         * Fires before start drawing content for this {id} view.
         *
         * @param WPDKView $view This view
         */
        do_action('wpdk_view_will_draw_content-' . $this->id, $this);
        ?>

    <?php 
        /**
         * Fires before start drawing content for this view.
         *
         * @param WPDKView $view This view
         */
        do_action('wpdk_view_will_draw_content', $this);
        ?>

    <?php 
        $this->draw();
        ?>

    <?php 
        if (is_array($this->subviews)) {
            ?>
      <?php 
            /**
             * @var WPDKView $view
             */
            foreach ($this->subviews as $view) {
                ?>
        <?php 
                $view->display();
                ?>
      <?php 
            }
            ?>
    <?php 
        }
        ?>

    <?php 
        /**
         * Fires after drawing content for this view.
         *
         * @param WPDKView $view This view
         */
        do_action('wpdk_view_did_draw_content', $this);
        ?>

    <?php 
        /**
         * Fires after drawing content for this {id} view.
         *
         * @param WPDKView $view This view
         */
        do_action('wpdk_view_did_draw_content-' . $this->id, $this);
        ?>

  </div>

  <?php 
    }

Usage Example

Example #1
0
 /**
  * Display the content of this view controller
  *
  * @brief Display the view controller
  */
 public function display()
 {
     do_action($this->id . '_will_view_appear', $this);
     // @deprecated
     do_action('wpdk_view_controller_will_view_appear', $this->view, $this);
     $this->view->display();
     // @deprecated
     do_action('wpdk_view_controller_did_view_appear', $this->view, $this);
     do_action($this->id . '_did_view_appear', $this);
 }