本文整理汇总了PHP中Field::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Field::select方法的具体用法?PHP Field::select怎么用?PHP Field::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field::select方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_takes_select_options_from_the_model
public function test_takes_select_options_from_the_model()
{
// Having
Form::model(new \App\User());
// Expect
$this->assertTemplate('fields/select_model', Field::select('gender'));
}
示例2: selectByCompany
public static function selectByCompany($id)
{
$connection = Flight::dbMain();
try {
$sql = "SELECT * FROM company_info WHERE company_id = :company_id LIMIT 1;";
$query = $connection->prepare($sql);
$query->bindParam(':company_id', $id, PDO::PARAM_INT);
$query->execute();
if ($query->rowCount() < 1) {
return null;
}
$row = $query->fetch(PDO::FETCH_ASSOC);
$companyInfo = new CompanyInfo();
$companyInfo->Id = (int) $row['id'];
$companyInfo->Logo = $row['info_logo'];
$companyInfo->Alert = (int) $row['info_alert'];
$companyInfo->Notify = (int) $row['info_noti'];
$companyInfo->Theme = (int) $row['info_theme'];
$companyInfo->Field = Field::select($row['e_field_id']);
$companyInfo->Company = Company::select($row['company_id']);
return $companyInfo;
} catch (PDOException $pdoException) {
throw $pdoException;
} catch (Exception $exception) {
throw $exception;
} finally {
$connection = null;
}
}
示例3: slhb_set_title
<?php
/*-----------------------------------------------------------------------*/
// Match Custom Post
/*-----------------------------------------------------------------------*/
$match = PostType::make('slhb_match', 'Les matchs', 'match')->set(array('public' => true, 'menu_position' => 20, 'supports' => false, 'rewrite' => false, 'query_var' => false, 'labels' => ['add_new' => 'Ajouter un nouveau match', 'add_item' => 'Ajouter un match', 'all_items' => 'Tous les matchs', 'edit_item' => 'Modifier un match']));
/*-----------------------------------------------------------------------*/
// Match informations
/*-----------------------------------------------------------------------*/
$infos = Metabox::make('Informations du match', $match->get('name'))->set(array(Field::date('match_date', ['title' => 'Date du match']), Field::select('match_team_dom', TeamModel::getTeamsArray()), Field::text('match_team_ext', ['title' => 'Equipe à l\'exterieur']), Field::number('score_dom', ['title' => 'Score de l\'équipe à domicile']), Field::number('score_ext', ['title' => 'Score de l\'équipe extérieur'])));
/*-----------------------------------------------------------------------*/
// Match Defaults Values
/*-----------------------------------------------------------------------*/
function slhb_set_title($post_id, $post, $update)
{
$dateStr = Meta::get($post_id, 'match_date');
$title = $dateStr . ' - ' . Meta::get($post_id, 'match_team_dom') . ' - ' . Meta::get($post_id, 'match_team_ext');
$date = date($dateStr);
//This temporarily removes filter to prevent infinite loops
remove_action('save_post_slhb_match', __FUNCTION__);
wp_update_post(array('ID' => $post_id, 'post_title' => $title, 'match_date' => $date));
//redo filter
add_action('save_post_slhb_match', __FUNCTION__, 10, 3);
}
add_action('save_post_slhb_match', 'slhb_set_title', 10, 3);
示例4: __
<?php
$page = Page::make('theme-option', 'Option du theme')->set();
$sections = [Section::make('theme-option-general', __('General', THEME_TEXT_DOMAIN)), Section::make('theme-option-info', __("Society Information", THEME_TEXT_DOMAIN)), Section::make('theme-option-social', __("Social Network", THEME_TEXT_DOMAIN)), Section::make('theme-option-custom-code', __('Code', THEME_TEXT_DOMAIN)), Section::make('theme-option-analytic', __('Analytics', THEME_TEXT_DOMAIN)), Section::make('theme-option-image', __('Default Images', THEME_TEXT_DOMAIN))];
$settings = ['theme-option-general' => [Field::text('name', ['title' => __('Name', THEME_TEXT_DOMAIN)]), Field::text('separator', ['title' => __('Title separator', THEME_TEXT_DOMAIN), 'default' => '-']), Field::select('seplocation', [['right' => __("Right", THEME_TEXT_DOMAIN), 'left' => __("Left", THEME_TEXT_DOMAIN)]], ['title' => __("Title separator emplacement", THEME_TEXT_DOMAIN), 'default' => 'right']), Field::checkbox('showAuthor', ['activate' => 'Afficher l\'auteur'])], 'theme-option-custom-code' => [Field::textarea('javascript', ['title' => __('Javascript', THEME_TEXT_DOMAIN)], ['id' => 'javascript-editor', "class" => "hidden"]), Field::textarea('style', ['title' => __('Style', THEME_TEXT_DOMAIN)], ['id' => 'style-editor', "class" => "hidden"])], 'theme-option-info' => [Field::text('name', ['title' => __('Name', THEME_TEXT_DOMAIN)]), Field::textarea('biography', ['title' => __('Biography', THEME_TEXT_DOMAIN)]), Field::text('address', ['title' => __('Address', THEME_TEXT_DOMAIN)]), Field::text('phoneNumberPrimary', ['title' => __('Phone Number', THEME_TEXT_DOMAIN)], ['type' => 'tel']), Field::text('phoneNumberSecondary', ['title' => __('Phone Number', THEME_TEXT_DOMAIN)], ['type' => 'tel']), Field::text('emailPrimary', ['title' => __('Phone Number', THEME_TEXT_DOMAIN)], ['type' => 'email']), Field::text('emailSecondary', ['title' => __('Phone Number', THEME_TEXT_DOMAIN)], ['type' => 'email'])], 'theme-option-analytic' => [], 'theme-option-social' => [Field::text('facebook', ['title' => 'Facebook'], ['type' => 'url']), Field::text('twitter', ['title' => 'Twitter'], ['type' => 'url']), Field::text('google-plus', ['title' => 'Google plus'], ['type' => 'url']), Field::text('linkedin', ['title' => 'linkedIn'], ['type' => 'url']), Field::text('youtube', ['title' => 'YouTube'], ['type' => 'url']), Field::text('vkontakte', ['title' => 'Vkontakte'], ['type' => 'url']), Field::text('instagram', ['title' => 'Instagram'], ['type' => 'url']), Field::text('rss', ['title' => 'Feed'])], 'theme-option-image' => [Field::media('favicon', ['title' => __("Favicon", THEME_TEXT_DOMAIN)]), Field::media('logo', ['title' => __("Logo", THEME_TEXT_DOMAIN)])]];
$validation = ['name' => ['min:3', 'textfield'], 'facebook' => ['url'], 'twitter' => ['url'], 'google-plus' => ['url'], 'linkedin' => ['url'], 'youtube' => ['url'], 'vkontakte' => ['url'], 'Instagram' => ['url'], 'rss' => ['url']];
$page->addSections($sections);
$page->addSettings($settings);
$page->validate($validation);
示例5: function
}
});
//=============================================================================
//Field
//=============================================================================
Flight::route('GET /v1/main/field', function () {
try {
$array = Field::selectAll();
Flight::ok($array);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('GET /v1/main/field/@id', function ($id) {
try {
$object = Field::select($id);
Flight::ok($object);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('POST /v1/main/field', function () {
try {
$object = Field::insert();
Flight::ok($object);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('PUT /v1/main/field/@id', function ($id) {
try {
示例6: _set_up_timeslot
/**
* Set up timeslot custom post type
*
* @private
*/
private static function _set_up_timeslot()
{
PostType::make('timeslot', 'Time Slots', 'Time Slot')->set();
$fields = array(Field::select('timeslot_venue', array(array('none' => __('- None -')) + VenueModel::venueSelection()), array('title' => __('Venue'))), Field::select('timeslot_user', array(array('none' => __('- None -')) + UserModel::userSelection()), array('title' => __('User'))), Field::date('date', array('title' => 'Date')), Field::select('time_from', array(Config::get('application.timeslots')), array('title' => __('Start at'))), Field::select('time_to', array(Config::get('application.timeslots')), array('title' => __('Finish at'))));
Metabox::make('Options', 'timeslot')->set($fields);
}
示例7: get_option
<?php
/*-----------------------------------------------------------------------*/
// Home/Front page.
/*-----------------------------------------------------------------------*/
$home = (int) get_option('page_on_front');
if (themosis_is_post($home)) {
$books = new Books();
// Metabox for the front page.
Metabox::make('Book promo', 'page')->set(array(Field::select('book-promo', array($books->published()), false, array('title' => 'Book', 'info' => 'Choose a book to promote on the home page.'))));
}
/*-----------------------------------------------------------------------*/
// Remove editor from home page.
/*-----------------------------------------------------------------------*/
add_action('init', function () use($home) {
if (themosis_is_post($home)) {
remove_post_type_support('page', 'editor');
}
});
示例8: array
<?php
$team = PostType::make('slhb_team', 'Les équipes', 'équipe')->set(array('public' => true, 'menu_position' => 20, 'supports' => array('title', 'editor'), 'rewrite' => false, 'query_var' => false, 'labels' => ['add_new_item' => 'Ajouter une nouvelle équipe', 'add_new' => 'Ajouter une équipe', 'add_item' => 'Ajouter une équipe', 'all_items' => 'Toutes les équipes', 'edit_item' => 'Modifier une équipe']));
/*-----------------------------------------------------------------------*/
// Team informations
/*-----------------------------------------------------------------------*/
$infos = Metabox::make('Informations sur l\'équipe', $team->get('name'))->set(array(Field::media('profile', ['title' => 'Photo de groupe de l\'équipe ']), Field::select('Niveau', [['Excellence Région', 'Honneur Région', 'Pré-Région', 'Deuxième division']], ['title' => 'Quelle division? ']), Field::collection('gallery')));