styleInline() public static method

$styles = array( 'position' => 'absolute', 'top' => 0, ); echo self::styleInline( $styles, array( 'left' => 0, 'display' => 'block' ) ); 'position:absolute;top:0;left:0;display:block' echo self::styleInline( $styles, 'display:block' ); 'position:absolute;top:0;display:block'
Since: 1.4.7
public static styleInline ( array | string $styles, array | boolean $additional_styles = false ) : string
$styles array | string List of css styles
$additional_styles array | boolean Optional. Additional styles
return string
コード例 #1
0
ファイル: wpdk-ui-controls.php プロジェクト: wpxtreme/wpdk
 /**
  * This is a utility method to display a common input type
  *
  * @brief Common input control
  *
  * @param string|WPDKHTMLTagInputType $type  Optional. Type of input
  * @param string                       $class Optional. CSS additional class
  */
 protected function inputType($type = WPDKHTMLTagInputType::TEXT, $class = '')
 {
     echo $this->contentWithKey('prepend');
     // Create the label
     $label = $this->label();
     // Display right label
     echo is_null($label) ? '' : $label->html();
     $input = new WPDKHTMLTagInput('', $this->name, $this->id);
     $input->type = $type;
     $input->class = WPDKHTMLTag::mergeClasses($this->class, $class, trim('wpdk-form-input wpdk-ui-control ' . (is_null($label) ? 'wpdk-has-tooltip' : '')));
     $input->style = WPDKHTMLTag::styleInline(isset($this->item['style']) ? $this->item['style'] : '');
     $input->data = isset($this->item['data']) ? $this->item['data'] : '';
     $input->value = isset($this->item['value']) ? $this->item['value'] : '';
     $input->autocomplete = isset($this->item['autocomplete']) ? $this->item['autocomplete'] : null;
     $input->disabled = isset($this->item['disabled']) ? $this->item['disabled'] ? 'disabled' : null : null;
     $input->readonly = isset($this->item['readonly']) ? $this->item['readonly'] ? 'readonly' : null : null;
     $input->required = isset($this->item['required']) ? $this->item['required'] ? 'required' : null : null;
     $input->min = isset($this->item['min']) ? $this->item['min'] : '';
     $input->max = isset($this->item['max']) ? $this->item['max'] : '';
     $input->step = isset($this->item['step']) ? $this->item['step'] : '';
     if (WPDKHTMLTagInputType::HIDDEN != $type) {
         $input->size = isset($this->item['size']) ? $this->item['size'] : $this->sizeForType($this->item['type']);
         $input->title = is_null($label) ? isset($this->item['title']) ? $this->item['title'] : '' : '';
         $input->placeholder = isset($this->item['placeholder']) ? $this->item['placeholder'] : '';
     }
     $input->setPropertiesByArray(isset($this->item['attrs']) ? $this->item['attrs'] : '');
     if (isset($this->item['locked']) && true == $this->item['locked']) {
         $input->readonly = 'readonly';
     }
     // Add a clear button icon for this types
     $add_clear_default_for_types = in_array($this->item['type'], array(WPDKUIControlType::DATE, WPDKUIControlType::DATETIME));
     // And add the clear button if "add_clear" is set
     if ($add_clear_default_for_types || isset($this->item['add_clear'])) {
         // Add special class
         $input->class[] = 'wpdk-form-has-button-clear-left';
         // Create icon clear
         $span_clear = new WPDKHTMLTagSpan();
         $span_clear->class[] = 'wpdk-form-clear-left';
         $span_clear->content = $input->html() . WPDKGlyphIcons::html(WPDKGlyphIcons::CANCEL_CIRCLED);
         $span_clear->display();
     } else {
         $input->display();
     }
     if (isset($this->item['locked']) && true == $this->item['locked']) {
         printf('<span title="%s" class="wpdk-form-locked wpdk-has-tooltip"></span>', __('This field is locked for your security. However you can unlock just by click here.', WPDK_TEXTDOMAIN));
     }
     echo $this->contentWithKey('append');
     echo ' ' . $this->guide();
 }
コード例 #2
0
ファイル: wpdk-view.php プロジェクト: wpxtreme/wpdk
    /**
     * Display the HTML markup content for this view.
     *
     * @brief Display view content
     *
     * @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 
    }