本文整理汇总了PHP中Widget::form方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::form方法的具体用法?PHP Widget::form怎么用?PHP Widget::form使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget::form方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form
/**
* Renders the form for the widget
*
* @param array $data Database values
*/
public function form($data)
{
$defaults = array('core_campus_id' => null, 'core_id' => null, 'core_involvement_id' => null, 'limit' => null, 'start_date' => null, 'end_date' => null);
$data = array_merge($defaults, $data);
parent::form($data);
}
示例2: array
<?php
}
}
$args = array('post_type' => 'any', 'post_status' => 'any', 'posts_per_page' => -1, 'update_post_term_cache' => false, 'meta_query' => array(array('key' => SHORTCODE_META, 'compare' => 'EXISTS')));
$posts = get_posts($args);
if (count($posts) > 0) {
$wp_customize->add_section(__NAMESPACE__, array('title' => __('Category Posts Shortcode', TEXTDOMAIN), 'priority' => 200));
foreach ($posts as $p) {
$widget = new Widget();
$widget->number = $p->ID;
$meta = get_post_meta($p->ID, SHORTCODE_META, true);
if (!is_array($meta)) {
continue;
}
ob_start();
$widget->form(array());
$form = ob_get_clean();
$form = preg_replace_callback('/<(input|select)\\s+.*name=("|\').*\\[\\d*\\]\\[([^\\]]*)\\][^>]*>/', function ($matches) use($p, $wp_customize, $meta) {
$setting = '_virtual-' . WIDGET_BASE_ID . '[' . $p->ID . '][' . $matches[3] . ']';
if (!isset($meta[$matches[3]])) {
$meta[$matches[3]] = null;
}
$wp_customize->add_setting($setting, array('default' => $meta[$matches[3]], 'type' => 'option'));
return str_replace('<' . $matches[1], '<' . $matches[1] . ' data-customize-setting-link="' . $setting . '"', $matches[0]);
}, $form);
$wp_customize->add_control(new shortCodeControl($wp_customize, '_virtual-' . WIDGET_BASE_ID . '[' . $p->ID . '][title]', array('label' => __('Layout', 'twentyfourteen'), 'section' => __NAMESPACE__, 'form' => $form, 'settings' => '_virtual-' . WIDGET_BASE_ID . '[' . $p->ID . '][title]', 'active_callback' => function () use($p) {
return is_singular() && get_the_ID() == $p->ID;
})));
}
}
}
示例3: form
/**
* Renders the form for the widget
*
* @param array $data Database values
*/
public function form($data)
{
$defaults = array('title' => 'Instagram', 'columns' => 2, 'username' => null, 'limit' => 4, 'before_content' => '', 'after_content' => '');
$data = array_merge($defaults, $data);
parent::form($data);
}
示例4: form
/**
* Renders the form for the widget
*
* @param array $data Database values
*/
public function form($data)
{
$defaults = array('columns' => 2, 'images' => array(), 'image_links' => array(), 'before_content' => '', 'after_content' => '');
$data = array_merge($defaults, $data);
parent::form($data);
}
示例5: form
/**
* Renders the form for the widget
*
* @param array $data Database values
*/
public function form($data)
{
$defaults = array('title' => null, 'twitter_limit' => null);
$data = array_merge($defaults, $data);
parent::form($data);
}