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


PHP acf_get_field_label函数代码示例

本文整理汇总了PHP中acf_get_field_label函数的典型用法代码示例。如果您正苦于以下问题:PHP acf_get_field_label函数的具体用法?PHP acf_get_field_label怎么用?PHP acf_get_field_label使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: acf_render_field_wrap

function acf_render_field_wrap($field, $el = 'div', $instruction = 'label')
{
    // get valid field
    $field = acf_get_valid_field($field);
    // prepare field for input
    $field = acf_prepare_field($field);
    // el
    $elements = apply_filters('acf/render_field_wrap/elements', array('div' => 'div', 'tr' => 'td', 'ul' => 'li', 'ol' => 'li', 'dl' => 'dt', 'td' => 'div'));
    // validate $el
    if (!array_key_exists($el, $elements)) {
        $el = 'div';
    }
    // wrapper
    $wrapper = array('id' => '', 'class' => 'acf-field', 'width' => '', 'style' => '', 'data-name' => $field['name'], 'data-type' => $field['type'], 'data-key' => '');
    // add required
    if ($field['required']) {
        $wrapper['data-required'] = 1;
    }
    // add type
    $wrapper['class'] .= " acf-field-{$field['type']}";
    // add key
    if ($field['key']) {
        $wrapper['class'] .= " acf-field-{$field['key']}";
        $wrapper['data-key'] = $field['key'];
    }
    // replace
    $wrapper['class'] = str_replace('_', '-', $wrapper['class']);
    $wrapper['class'] = str_replace('field-field-', 'field-', $wrapper['class']);
    // wrap classes have changed (5.2.7)
    if (acf_get_compatibility('field_wrapper_class')) {
        $wrapper['class'] .= " field_type-{$field['type']}";
        if ($field['key']) {
            $wrapper['class'] .= " field_key-{$field['key']}";
        }
    }
    // merge in atts
    $wrapper = acf_merge_atts($wrapper, $field['wrapper']);
    // add width
    $width = (int) acf_extract_var($wrapper, 'width');
    if ($el == 'tr' || $el == 'td') {
        $width = 0;
    } elseif ($width > 0 && $width < 100) {
        $wrapper['data-width'] = $width;
        $wrapper['style'] .= " width:{$width}%;";
    }
    // remove empty attributes
    foreach ($wrapper as $k => $v) {
        if ($v == '') {
            unset($wrapper[$k]);
        }
    }
    // vars
    $show_label = $el !== 'td' ? true : false;
    ?>
<<?php 
    echo $el;
    ?>
 <?php 
    echo acf_esc_attr($wrapper);
    ?>
>
<?php 
    if ($show_label) {
        ?>
	<<?php 
        echo $elements[$el];
        ?>
 class="acf-label">
		<label for="<?php 
        echo $field['id'];
        ?>
"><?php 
        echo acf_get_field_label($field);
        ?>
</label>
<?php 
        if ($instruction == 'label' && $field['instructions']) {
            ?>
		<p class="description"><?php 
            echo $field['instructions'];
            ?>
</p>
<?php 
        }
        ?>
	</<?php 
        echo $elements[$el];
        ?>
>
<?php 
    }
    ?>
	<<?php 
    echo $elements[$el];
    ?>
 class="acf-input">
		<?php 
    acf_render_field($field);
    if ($instruction == 'field' && $field['instructions']) {
        ?>
//.........这里部分代码省略.........
开发者ID:coreymargulis,项目名称:karenmargulis,代码行数:101,代码来源:api-field.php

示例2: render_field_table

        function render_field_table($field)
        {
            ?>
<table class="acf-table">
	<thead>
		<tr>
		<?php 
            foreach ($field['sub_fields'] as $sub_field) {
                $atts = array('class' => 'acf-th', 'data-key' => $sub_field['key']);
                // add type
                $atts['class'] .= ' acf-th-' . $sub_field['type'];
                // Add custom width
                if ($sub_field['wrapper']['width']) {
                    $atts['data-width'] = $sub_field['wrapper']['width'];
                }
                ?>
			<th <?php 
                acf_esc_attr_e($atts);
                ?>
>
				<?php 
                echo acf_get_field_label($sub_field);
                ?>
				<?php 
                if ($sub_field['instructions']) {
                    ?>
					<p class="description"><?php 
                    echo $sub_field['instructions'];
                    ?>
</p>
				<?php 
                }
                ?>
			</th>
		<?php 
            }
            ?>
		</tr>
	</thead>
	<tbody>
		<tr class="acf-row">
		<?php 
            foreach ($field['sub_fields'] as $sub_field) {
                acf_render_field_wrap($sub_field, 'td');
            }
            ?>
		</tr>
	</tbody>
</table>
<?php 
        }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:51,代码来源:clone.php

示例3: _e

				<span class="acf-icon acf-sortable-handle"><?php 
echo $i + 1;
?>
</span>
				<pre class="pre-field-key"><?php 
echo $field['key'];
?>
</pre>
			</li>
			<li class="li-field-label">
				<strong>
					<a class="edit-field" title="<?php 
_e("Edit field", 'acf');
?>
" href="#"><?php 
echo acf_get_field_label($field);
?>
</a>
				</strong>
				<div class="row-options">
					<a class="edit-field" title="<?php 
_e("Edit field", 'acf');
?>
" href="#"><?php 
_e("Edit", 'acf');
?>
</a>
					<a class="duplicate-field" title="<?php 
_e("Duplicate field", 'acf');
?>
" href="#"><?php 
开发者ID:gecugamo,项目名称:customledgers,代码行数:31,代码来源:field-group-field.php

示例4: render_layout

        function render_layout($field, $layout, $i, $value)
        {
            // vars
            $order = 0;
            $el = 'div';
            $div = array('class' => 'layout', 'data-id' => $i, 'data-layout' => $layout['name']);
            // collapsed class
            if (acf_is_row_collapsed($field['key'], $i)) {
                $div['class'] .= ' -collapsed';
            }
            // clone
            if (is_numeric($i)) {
                $order = $i + 1;
            } else {
                $div['class'] .= ' acf-clone';
            }
            // title
            $title = $this->get_layout_title($field, $layout, $i, $value);
            // remove row
            reset_rows();
            ?>
<div <?php 
            acf_esc_attr_e($div);
            ?>
>
			
	<div class="acf-hidden">
		<?php 
            acf_hidden_input(array('name' => "{$field['name']}[{$i}][acf_fc_layout]", 'value' => $layout['name']));
            ?>
	</div>
	
	<div class="acf-fc-layout-handle" title="<?php 
            _e('Drag to reorder', 'acf');
            ?>
"><?php 
            echo $title;
            ?>
</div>
	
	<ul class="acf-fc-layout-controlls acf-hl">
		<li class="acf-fc-show-on-hover">
			<a class="acf-icon -plus small" href="#" data-event="add-layout" title="<?php 
            _e('Add layout', 'acf');
            ?>
"></a>
		</li>
		<li class="acf-fc-show-on-hover">
			<a class="acf-icon -minus small" href="#" data-event="remove-layout" title="<?php 
            _e('Remove layout', 'acf');
            ?>
"></a>
		</li>
		<li>
			<a class="acf-icon -collapse small" href="#" data-event="collapse-layout" title="<?php 
            _e('Click to toggle', 'acf');
            ?>
"></a>
		</li>
	</ul>
	
<?php 
            if (!empty($layout['sub_fields'])) {
                ?>
	
	<?php 
                if ($layout['display'] == 'table') {
                    // update vars
                    $el = 'td';
                    ?>
	<table class="acf-table">
		
		<thead>
			<tr>
				<?php 
                    foreach ($layout['sub_fields'] as $sub_field) {
                        $atts = array('class' => "acf-th acf-th-{$sub_field['name']}", 'data-key' => $sub_field['key']);
                        // Add custom width
                        if ($sub_field['wrapper']['width']) {
                            $atts['data-width'] = $sub_field['wrapper']['width'];
                        }
                        ?>
					<th <?php 
                        acf_esc_attr_e($atts);
                        ?>
>
						<?php 
                        echo acf_get_field_label($sub_field);
                        ?>
						<?php 
                        if ($sub_field['instructions']) {
                            ?>
							<p class="description"><?php 
                            echo $sub_field['instructions'];
                            ?>
</p>
						<?php 
                        }
                        ?>
					</th>
//.........这里部分代码省略.........
开发者ID:cimocimocimo,项目名称:staydrysystems.com,代码行数:101,代码来源:flexible-content.php

示例5: acf_the_field_label

function acf_the_field_label($field)
{
    echo acf_get_field_label($field);
}
开发者ID:mariussunde,项目名称:Sn-hetta-Designmanual-WP-Theme,代码行数:4,代码来源:api-helpers.php

示例6: foreach

				<thead>
					<tr>
						<?php 
        foreach ($layout['sub_fields'] as $sub_field) {
            $atts = array('class' => "acf-th acf-th-{$sub_field['name']}", 'data-key' => $sub_field['key']);
            // Add custom width
            if ($sub_field['wrapper']['width']) {
                $atts['data-width'] = $sub_field['wrapper']['width'];
            }
            ?>
							<th <?php 
            acf_esc_attr_e($atts);
            ?>
>
								<?php 
            echo acf_get_field_label($sub_field);
            ?>
								<?php 
            if ($sub_field['instructions']) {
                ?>
						<p class="description"><?php 
                echo $sub_field['instructions'];
                ?>
</p>
					<?php 
            }
            ?>
					</th>

				<?php 
        }
开发者ID:NikolaGrdanjski,项目名称:acf-views,代码行数:31,代码来源:field-flexible-content-layout.php

示例7: render_field_table

        function render_field_table($field)
        {
            ?>
<table class="acf-table">
	<thead>
		<tr>
		<?php 
            foreach ($field['sub_fields'] as $sub_field) {
                // prepare field (allow sub fields to be removed)
                $sub_field = acf_prepare_field($sub_field);
                // bail ealry if no field
                if (!$sub_field) {
                    continue;
                }
                // vars
                $atts = array();
                $atts['class'] = 'acf-th';
                $atts['data-name'] = $sub_field['_name'];
                $atts['data-type'] = $sub_field['type'];
                $atts['data-key'] = $sub_field['key'];
                // Add custom width
                if ($sub_field['wrapper']['width']) {
                    $atts['data-width'] = $sub_field['wrapper']['width'];
                    $atts['style'] = 'width: ' . $sub_field['wrapper']['width'] . '%;';
                }
                ?>
			<th <?php 
                acf_esc_attr_e($atts);
                ?>
>
				<?php 
                echo acf_get_field_label($sub_field);
                ?>
				<?php 
                if ($sub_field['instructions']) {
                    ?>
					<p class="description"><?php 
                    echo $sub_field['instructions'];
                    ?>
</p>
				<?php 
                }
                ?>
			</th>
		<?php 
            }
            ?>
		</tr>
	</thead>
	<tbody>
		<tr class="acf-row">
		<?php 
            foreach ($field['sub_fields'] as $sub_field) {
                acf_render_field_wrap($sub_field, 'td');
            }
            ?>
		</tr>
	</tbody>
</table>
<?php 
        }
开发者ID:rmikeska,项目名称:ushipnetwork,代码行数:61,代码来源:clone.php

示例8: render_field


//.........这里部分代码省略.........
            acf_esc_attr_e($div);
            ?>
>
<table class="acf-table">
	
	<?php 
            if ($field['layout'] == 'table') {
                ?>
		<thead>
			<tr>
				<?php 
                if ($show_order) {
                    ?>
					<th class="acf-row-handle"></th>
				<?php 
                }
                ?>
				
				<?php 
                foreach ($field['sub_fields'] as $sub_field) {
                    $atts = array('class' => 'acf-th', 'data-key' => $sub_field['key']);
                    // add type
                    $atts['class'] .= ' acf-th-' . $sub_field['type'];
                    // Add custom width
                    if ($sub_field['wrapper']['width']) {
                        $atts['data-width'] = $sub_field['wrapper']['width'];
                    }
                    ?>
					<th <?php 
                    acf_esc_attr_e($atts);
                    ?>
>
						<?php 
                    echo acf_get_field_label($sub_field);
                    ?>
						<?php 
                    if ($sub_field['instructions']) {
                        ?>
							<p class="description"><?php 
                        echo $sub_field['instructions'];
                        ?>
</p>
						<?php 
                    }
                    ?>
					</th>
					
				<?php 
                }
                ?>

				<?php 
                if ($show_remove) {
                    ?>
					<th class="acf-row-handle"></th>
				<?php 
                }
                ?>
			</tr>
		</thead>
	<?php 
            }
            ?>
	
	<tbody>
		<?php 
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:67,代码来源:repeater.php

示例9: render_field


//.........这里部分代码省略.........
				<?php 
                if ($show_order) {
                    ?>
					<th class="acf-row-handle"></th>
				<?php 
                }
                ?>
				
				<?php 
                foreach ($sub_fields as $sub_field) {
                    // prepare field (allow sub fields to be removed)
                    $sub_field = acf_prepare_field($sub_field);
                    // bail ealry if no field
                    if (!$sub_field) {
                        continue;
                    }
                    // vars
                    $atts = array();
                    $atts['class'] = 'acf-th';
                    $atts['data-name'] = $sub_field['_name'];
                    $atts['data-type'] = $sub_field['type'];
                    $atts['data-key'] = $sub_field['key'];
                    // Add custom width
                    if ($sub_field['wrapper']['width']) {
                        $atts['data-width'] = $sub_field['wrapper']['width'];
                        $atts['style'] = 'width: ' . $sub_field['wrapper']['width'] . '%;';
                    }
                    ?>
					<th <?php 
                    echo acf_esc_attr($atts);
                    ?>
>
						<?php 
                    echo acf_get_field_label($sub_field);
                    ?>
						<?php 
                    if ($sub_field['instructions']) {
                        ?>
							<p class="description"><?php 
                        echo $sub_field['instructions'];
                        ?>
</p>
						<?php 
                    }
                    ?>
					</th>
				<?php 
                }
                ?>

				<?php 
                if ($show_remove) {
                    ?>
					<th class="acf-row-handle"></th>
				<?php 
                }
                ?>
			</tr>
		</thead>
	<?php 
            }
            ?>
	
	<tbody>
		<?php 
            foreach ($value as $i => $row) {
开发者ID:rmikeska,项目名称:ushipnetwork,代码行数:67,代码来源:repeater.php

示例10: acf_views_render_field_wrap

function acf_views_render_field_wrap($field, $el = 'div', $instruction = 'label')
{
    // get valid field
    $field = acf_get_valid_field($field);
    // prepare field for input
    $field = acf_prepare_field($field);
    // el
    $elements = apply_filters('acf/render_field_wrap/elements', array('div' => 'div', 'tr' => 'td', 'ul' => 'li', 'ol' => 'li', 'dl' => 'dt', 'td' => 'div'));
    // validate $el
    if (!array_key_exists($el, $elements)) {
        $el = 'div';
    }
    // wrapper
    $wrapper = array('id' => '', 'class' => 'acf-field', 'width' => '', 'style' => '', 'data-name' => $field['name'], 'data-type' => $field['type'], 'data-key' => '');
    // add required
    if ($field['required']) {
        $wrapper['data-required'] = 1;
    }
    // add type
    $wrapper['class'] .= " acf-output-{$field['type']}";
    // add key
    if ($field['key']) {
        $wrapper['class'] .= " acf-field-{$field['key']}";
        $wrapper['data-key'] = $field['key'];
    }
    // replace
    $wrapper['class'] = str_replace('_', '-', $wrapper['class']);
    $wrapper['class'] = str_replace('field-field-', 'field-', $wrapper['class']);
    // merge in atts
    $wrapper = acf_merge_atts($wrapper, $field['wrapper']);
    // add width
    $width = (int) acf_extract_var($wrapper, 'width');
    if ($el == 'tr' || $el == 'td') {
        $width = 0;
    } elseif ($width > 0 && $width < 100) {
        $wrapper['data-width'] = $width;
        $wrapper['style'] .= " width:{$width}%;";
    }
    // remove empty attributes
    foreach ($wrapper as $k => $v) {
        if ($v == '') {
            unset($wrapper[$k]);
        }
    }
    // vars
    $show_label = true;
    if ($el == 'td') {
        $show_label = false;
    }
    ?>
<<?php 
    echo $el;
    ?>
 <?php 
    echo acf_esc_attr($wrapper);
    ?>
>
	<?php 
    if ($show_label) {
        ?>
		<<?php 
        echo $elements[$el];
        ?>
 class="acf-label">
		<label for="<?php 
        echo $field['id'];
        ?>
"><?php 
        echo acf_get_field_label($field);
        ?>
</label>
		<?php 
        if ($instruction == 'label' && $field['instructions']) {
            ?>
			<p class="description"><?php 
            echo $field['instructions'];
            ?>
</p>
		<?php 
        }
        ?>
		</<?php 
        echo $elements[$el];
        ?>
>
	<?php 
    }
    ?>
	<<?php 
    echo $elements[$el];
    ?>
 class="acf-input">

	<?php 
    acf_views_render_field($field);
    ?>

	<?php 
    if ($instruction == 'field' && $field['instructions']) {
        ?>
//.........这里部分代码省略.........
开发者ID:NikolaGrdanjski,项目名称:acf-views,代码行数:101,代码来源:acf-views-api.php


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