当前位置: 首页>>代码示例>>PHP>>正文


PHP Render::parse_shortcode_att方法代码示例

本文整理汇总了PHP中Render::parse_shortcode_att方法的典型用法代码示例。如果您正苦于以下问题:PHP Render::parse_shortcode_att方法的具体用法?PHP Render::parse_shortcode_att怎么用?PHP Render::parse_shortcode_att使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Render的用法示例。


在下文中一共展示了Render::parse_shortcode_att方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _render_add_content_to_atts

/**
 * Adds the "content" att to shortcodes on the Widgets page.
 *
 * @since 1.0.0
 *
 * @param array $atts The current shortcode's atts.
 * @param string $code The code of the current shortcode.
 * @param array $shortcode The current shortcode properties.
 * @return array The new attributes
 */
function _render_add_content_to_atts($atts, $code, $shortcode)
{
    if ($shortcode['wrapping']) {
        $content_att = Render::parse_shortcode_att(array('type' => 'textarea', 'label' => __('Content', 'Render'), 'required' => true));
        // Add to repeater here instead for nested shortcodes
        if (isset($shortcode['render']['nested']['child'])) {
            $atts['nested_children']['properties']['fields']['content'] = $content_att;
            // Remove the dummy field, if it's set. Having the content makes it no longer necessary
            unset($atts['nested_children']['properties']['fields']['dummy_field']);
        } else {
            $atts = array_merge(array('content' => $content_att), $atts);
        }
    }
    return $atts;
}
开发者ID:joffcrabtree,项目名称:render,代码行数:25,代码来源:widget.php

示例2: parse_shortcode_att

 /**
  * Sets up the shortcode attribute's defaults.
  *
  * @since 1.1-beta-2
  *
  * @param array $att The att to parse.
  * @return array The parsed att.
  */
 public static function parse_shortcode_att($att)
 {
     // Establish default attribute properties (if any exist)
     $att = wp_parse_args($att, self::$att_defaults);
     // Apply defaults to repeater fields as well
     if (isset($att['properties']['fields'])) {
         array_walk($att['properties']['fields'], function (&$properties) {
             $properties = Render::parse_shortcode_att($properties);
         });
     }
     // Setup conditionals
     if ($att['conditional'] !== false) {
         // Flip array key / value and set the value to an empty array for populate conditionals.
         // This makes it easier when creating the shortcode array because you can input a single
         // dimensional, non-associative array.
         if (isset($att['conditional']['populate'])) {
             $att['conditional']['populate']['atts'] = array_flip($att['conditional']['populate']['atts']);
             array_walk($att['conditional']['populate']['atts'], function (&$value) {
                 $value = array();
             });
         }
     }
     return $att;
 }
开发者ID:joffcrabtree,项目名称:render,代码行数:32,代码来源:render.php

示例3: att_type_repeater

    /**
     * Outputs the field HTML of the repeater attribute.
     *
     * @since  1.0.0
     * @access private
     *
     * @param string $att_id     The attribute ID.
     * @param array  $att        Properties of the attribute.
     * @param array  $properties Properties of the attribute field type.
     */
    private static function att_type_repeater($att_id, $att, $properties)
    {
        // Setup defaults;
        $properties = wp_parse_args($properties, array('fields' => array('dummy_field' => array('type' => 'hidden', 'default' => 1)), 'startWith' => 1));
        // Add content for nested shortcodes
        if ($att_id == 'nested_children' && !isset($properties['fields']['content'])) {
            $properties['fields']['content'] = Render::parse_shortcode_att(array('type' => 'hidden'));
        }
        foreach ($properties['fields'] as $field_ID => $field) {
            $properties['fields'][$field_ID]['disabled'] = true;
        }
        for ($i = 0; $i < intval($properties['startWith']) + 1; $i++) {
            // Make sure the dummy field (the first field) doesn't init any atts
            if ($i == 0) {
                foreach ($properties['fields'] as $field_ID => $field) {
                    $properties['fields'][$field_ID]['noInit'] = true;
                }
            } else {
                foreach ($properties['fields'] as $field_ID => $field) {
                    $properties['fields'][$field_ID]['noInit'] = false;
                }
            }
            ?>
			<div class="render-modal-repeater-field <?php 
            echo $i == 0 ? 'dummy-field' : '';
            ?>
"
				<?php 
            echo $i == 0 ? 'style="display:none"' : '';
            ?>
				<?php 
            echo isset($properties['max']) ? "data-max='{$properties['max']}'" : '';
            ?>
>

				<?php 
            // Dummy input to trigger field
            ?>
				<input type="hidden" name="<?php 
            echo $att_id;
            ?>
" class="render-modal-att-input"/>

				<div class="render-modal-repeater-inputs">
					<?php 
            if (!$properties['fields']) {
                echo isset($properties['noFields']) ? $properties['noFields'] : __('No fields set');
            } else {
                self::_atts_loop($properties['fields']);
            }
            ?>
				</div>

				<div class="render-modal-repeater-actions">
					<span class="render-modal-repeater-remove render-modal-button dashicons dashicons-minus"></span>
					<span class="render-modal-repeater-add render-modal-button dashicons dashicons-plus"></span>
				</div>
			</div>
		<?php 
        }
    }
开发者ID:joffcrabtree,项目名称:render,代码行数:71,代码来源:modal.php


注:本文中的Render::parse_shortcode_att方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。