本文整理汇总了PHP中PBHelper::returnIf方法的典型用法代码示例。如果您正苦于以下问题:PHP PBHelper::returnIf方法的具体用法?PHP PBHelper::returnIf怎么用?PHP PBHelper::returnIf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBHelper
的用法示例。
在下文中一共展示了PBHelper::returnIf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFieldTypeCheckbox
function createFieldTypeCheckbox($name, $data)
{
$i = 0;
$html = null;
foreach ($data['ui']['element']['dictionary']['source'] as $index => $value) {
$id = $name . '_' . ++$i;
$html .= '
<input type="checkbox" name="' . $name . '" id="' . $id . '" value="' . $index . '" ' . PBHelper::returnIf((array) $data['ui']['element']['value'], $index, 'checked') . '/>
<label for="' . $id . '">' . $value . '</label>
';
}
$html = '
<div class="pb-checkbox-button pb-clear-fix">
' . $html . '
</div>
';
return $html;
}
示例2: start_el
//.........这里部分代码省略.........
]"><?php
echo esc_html($item->description);
// textarea_escaped
?>
</textarea>
<span class="description"><?php
_e('The description will be displayed in the menu if the current theme supports it.');
?>
</span>
</label>
</p>
<?php
if ($depth == 0) {
$Layout = new PBLayout();
$ComponentMenu = new PBComponentMenu();
?>
<p class="field-custom description description-wide">
<label for="edit-menu-item-icon-<?php
echo $item_id;
?>
">
<?php
_e('Icon');
?>
<br />
<select id="edit-menu-item-icon-<?php
echo $item_id;
?>
" name="menu_item_icon[<?php
echo $item_id;
?>
]" class="widefat code edit-menu-item-custom">
<?php
echo '<option value="-1" ' . PBHelper::returnIf($item->icon, -1, 'selected') . '>' . esc_html__('[None]', PLUGIN_PAGE_BUILDER_DOMAIN) . '</option>';
foreach ($ComponentMenu->icon_file as $index => $value) {
echo '<option value="' . esc_attr($index) . '" ' . PBHelper::returnIf($item->icon, $index, 'selected') . '>' . esc_html($value) . '</option>';
}
?>
</select>
</label>
</p>
<p class="field-custom description description-wide">
<label for="edit-menu-item-mega-menu-enable-<?php
echo $item_id;
?>
">
<input type="checkbox" id="edit-menu-item-mega-menu-enable-<?php
echo $item_id;
?>
" value="1" name="menu_item_mega_menu_enable[<?php
echo $item_id;
?>
]"<?php
checked($item->mega_menu_enable, '1');
?>
/>
<span class="description"><?php
_e('Enable Mega Menu');
?>
</span>
</label>
</p>
<p class="field-custom description description-wide field-group-mega-menu">
<label for="edit-menu-item-mega-menu-layout-<?php
echo $item_id;
?>
示例3: foreach
if (is_array($this->data['option']['team_social'])) {
foreach ($this->data['option']['team_social'] as $index => $value) {
?>
<tr>
<td>
<div class="pb-clear-fix">
<select name="<?php
PBHelper::getFormName('team_social_name[]');
?>
" id="<?php
PBHelper::getFormName('team_social_name_' . PBHelper::createId(16));
?>
">
<?php
foreach ($this->data['dictionary']['social'] as $socialIndex => $socialValue) {
echo '<option value="' . esc_attr($socialIndex) . '" ' . PBHelper::returnIf($value['team_social_name'], $socialIndex, 'selected', false) . '>' . esc_html($socialValue[0]) . '</option>';
}
?>
</select>
</div>
</td>
<td>
<div class="pb-clear-fix">
<input type="text" name="<?php
PBHelper::getFormName('team_social_url[]');
?>
" value="<?php
echo esc_attr($value['team_social_url']);
?>
"/>
</div>
示例4: esc_html_e
echo PBHelper::returnIf($this->data['option']['enable_post'], 1);
?>
/>
<label for="<?php
PBHelper::getFormName('enable_post_1');
?>
"><?php
esc_html_e('Enable', PLUGIN_PAGE_BUILDER_DOMAIN);
?>
</label>
<input type="radio" name="<?php
PBHelper::getFormName('enable_post');
?>
" id="<?php
PBHelper::getFormName('enable_post_2');
?>
" value="0" <?php
echo PBHelper::returnIf($this->data['option']['enable_post'], 0);
?>
/>
<label for="<?php
PBHelper::getFormName('enable_post_2');
?>
"><?php
esc_html_e('Disable', PLUGIN_PAGE_BUILDER_DOMAIN);
?>
</label>
</div>
</div>
</li>
</ul>