TitanFrameworkOptionMulticheck::display PHP Method

display() public method

* Display for options and meta
public display ( )
    public function display()
    {
        $this->echoOptionHeader(true);
        echo '<fieldset>';
        $savedValue = $this->getValue();
        if (!empty($this->settings['select_all'])) {
            $select_all_label = __('Select All');
            if (is_string($this->settings['select_all'])) {
                $select_all_label = $this->settings['select_all'];
            }
            printf('<label style="margin-bottom: 1em !important;"><input class="tf_checkbox_selectall" type="checkbox" /> %s </label><br>', esc_html($select_all_label));
        }
        foreach ($this->settings['options'] as $value => $label) {
            printf('<label for="%s"><input id="%s" type="checkbox" name="%s[]" value="%s" %s/> %s</label><br>', $this->getID() . $value, $this->getID() . $value, $this->getID(), esc_attr($value), checked(in_array($value, $savedValue), true, false), $label);
        }
        echo '</fieldset>';
        $this->echoOptionFooter(false);
    }

Usage Example

 public function display()
 {
     $args = array('post_type' => $this->settings['post_type'], 'posts_per_page' => $this->settings['num'], 'post_status' => $this->settings['post_status'], 'orderby' => $this->settings['orderby'], 'order' => $this->settings['order']);
     $posts = get_posts($args);
     $this->settings['options'] = array();
     foreach ($posts as $post) {
         $this->settings['options'][$post->ID] = $post->post_title;
     }
     parent::display();
 }
All Usage Examples Of TitanFrameworkOptionMulticheck::display