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


PHP FormItem::custom方法代码示例

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


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

示例1: view

<?php

Admin::model('SleepingOwl\\AdminAuth\\Entities\\Administrator')->title('Administrators')->display(function () {
    $display = AdminDisplay::datatables();
    $display->order([[0, 'desc']]);
    $display->columns([Column::string('id')->label('ID'), Column::string('name')->label('Name'), Column::string('username')->label('Username')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::text('username', 'Username'), FormItem::text('name', 'Name'), FormItem::custom()->display(function ($instance) {
        return view('form.password_field', ['instance' => $instance]);
    })->callback(function ($instance) {
        $instance->password = Input::get('password');
    })]);
    return $form;
});
开发者ID:avilaj,项目名称:ocsport,代码行数:16,代码来源:Administrator.php

示例2: view

<?php

Admin::model('App\\Models\\BlogPost')->title('Статьи блога')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with('user', 'statusName');
    $display->filters([]);
    $display->columns([Column::string('id')->label('Id'), Column::string('title')->label('Заголовок'), Column::datetime('created_at')->label('Создан')->format('d.m.Y H:i'), Column::string('user.first_name')->label('Автор'), Column::string('statusName.name')->label('Статус')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::text('title', 'Заголовок'), FormItem::image('img', 'Изображение'), FormItem::text('slug', 'Slug'), FormItem::select('user_id', 'Автор')->model('App\\User')->display('first_name')->defaultValue(1), FormItem::select('status', 'Статус')->model('App\\Models\\PostStatus')->display('name')->defaultValue(1), FormItem::text('metakey', 'Metakey'), FormItem::text('metadesc', 'Metadesc'), FormItem::ckeditor('text', 'Текст статьи'), FormItem::custom('newtags', 'sssssssssss')->display(function ($instance) {
        return view('admin.formitem_tags', ['instance' => $instance]);
    })->callback(function ($instance) {
        $instance->retag($_POST['newtags']);
    })]);
    return $form;
});
开发者ID:AngryGantz,项目名称:cms-cookbook,代码行数:17,代码来源:BlogPost.php

示例3: config

            \Request::merge(['theme_sidebar_mini' => false]);
        } else {
            \Request::merge(['theme_sidebar_mini' => true]);
        }
        \SoaUserSetting::set('theme.sidebar_mini', \Request::input('theme_sidebar_mini'), $instance->id);
        \SoaUserSetting::save();
    }), FormItem::custom()->display(function ($instance) {
        $field_params = ['name' => 'theme.toggle_sidebar', 'lang' => null, 'label_size' => null, 'field_size' => null, 'label' => 'Toggle Sidebar', 'required_field' => false, 'value' => \SoaUserSetting::get('theme.toggle_sidebar', config('admintheme.toggle_sidebar'), $instance->id), 'help_text' => 'Toggle the left sidebar\'s state (open or collapse)'];
        return view(AdminTemplate::view('formitem.checkbox'), $field_params)->render();
    })->callback(function ($instance) {
        if (!\Request::has('theme_toggle_sidebar')) {
            \Request::merge(['theme_toggle_sidebar' => false]);
        } else {
            \Request::merge(['theme_toggle_sidebar' => true]);
        }
        \SoaUserSetting::set('theme.toggle_sidebar', \Request::input('theme_toggle_sidebar'), $instance->id);
        \SoaUserSetting::save();
    }), FormItem::custom()->display(function ($instance) {
        $field_params = ['name' => 'theme.sidebar_on_hover', 'lang' => null, 'label_size' => null, 'field_size' => null, 'label' => 'Sidebar on Hover', 'required_field' => false, 'value' => \SoaUserSetting::get('theme.sidebar_on_hover', config('admintheme.sidebar_on_hover'), $instance->id), 'help_text' => 'Let the sidebar mini expand on hover'];
        return view(AdminTemplate::view('formitem.checkbox'), $field_params)->render();
    })->callback(function ($instance) {
        if (!\Request::has('theme_sidebar_on_hover')) {
            \Request::merge(['theme_sidebar_on_hover' => false]);
        } else {
            \Request::merge(['theme_sidebar_on_hover' => true]);
        }
        \Setting::set('theme.sidebar_on_hover', \Request::input('theme_sidebar_on_hover'), $instance->id);
        \SoaUserSetting::save();
    })]]);
    return $form;
});
开发者ID:larabox,项目名称:larabox,代码行数:31,代码来源:User.php

示例4:

<?php

/*
 * This is a simple example of the main features.
 * For full list see documentation.
 */
Admin::model('App\\Models\\License')->title('Licenses')->alias('license')->display(function () {
    $display = AdminDisplay::datatablesAsync();
    $display->order([[0, 'asc']]);
    $display->columns([Column::string('name')->label('Name'), Column::string('duration')->label('Duration'), Column::custom()->label('Enabled')->callback(function ($instance) {
        return $instance->is_enabled ? '&check;' : '-';
    }), Column::custom()->label('Payed version')->callback(function ($instance) {
        return $instance->needs_validation ? '&check;' : '-';
    }), Column::datetime('created_at')->format('d-m-Y h:i:s')->label('Created'), Column::datetime('updated_at')->format('d-m-Y h:i:s')->label('Updated')]);
    $display->columnFilters([ColumnFilter::text()->placeholder('Name'), null, null, null, ColumnFilter::range()->from(ColumnFilter::date()->format('d.m.Y')->placeholder('From Date'))->to(ColumnFilter::date()->format('d.m.Y')->placeholder('To Date')), ColumnFilter::range()->from(ColumnFilter::date()->format('d.m.Y')->placeholder('From Date'))->to(ColumnFilter::date()->format('d.m.Y')->placeholder('To Date'))]);
    return $display;
})->edit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::custom()->display(function ($instance) {
        return '<div class="form-group ">
                                <label for="key">Key</label><br/>
                                ' . $instance->key . '
                            </div>';
    }), FormItem::text('name', 'Name')->required(), FormItem::text('duration', 'Duration')->required(), FormItem::checkbox('is_enabled', 'Enabled'), FormItem::checkbox('needs_validation', 'Payed version'), FormItem::ckeditor('description', 'Description')]);
    return $form;
})->create(function () {
    $form = AdminForm::form();
    $form->items([FormItem::text('name', 'Name')->required(), FormItem::text('duration', 'Duration')->required(), FormItem::checkbox('is_enabled', 'Enabled'), FormItem::checkbox('needs_validation', 'Payed version'), FormItem::ckeditor('description', 'Description')]);
    return $form;
});
开发者ID:AccessibilityNL,项目名称:User-Testing-Tool,代码行数:30,代码来源:License.php

示例5: view

<?php

Admin::model('App\\Form')->title('Form Items')->display(function () {
    $display = AdminDisplay::table();
    $display->columns([Column::string('id')->label('ID'), Column::string('title')->label('String'), Column::datetime('created_at')->label('Created At')->format('d.m.Y H:i:s')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::columns()->columns([[FormItem::text('title', 'FormItem::text')->defaultValue('default value')->required(), FormItem::textaddon('textaddon', 'FormItem::textaddon')->addon('$')->placement('after'), FormItem::checkbox('checkbox', 'FormItem::checkbox'), FormItem::date('date', 'FormItem::date')->format('d.m.Y'), FormItem::time('time', 'FormItem::time')->format('H:i:s')->seconds(true), FormItem::timestamp('timestamp', 'FormItem::timestamp')->format('d.m.Y g:i A')], [FormItem::select('select', 'FormItem::select')->options([1 => 'First', 2 => 'Second', 3 => 'Third'])->nullable(), FormItem::custom()->display(function ($instance) {
        return view('custom_form_item', compact('instance'));
    })->callback(function ($instance) {
        $instance->custom = \Carbon\Carbon::now();
    })], [FormItem::image('image', 'FormItem::image'), FormItem::images('images', 'FormItem::images')]]), FormItem::columns()->columns([[FormItem::textarea('textarea', 'FormItem::textarea')], [FormItem::ckeditor('ckeditor', 'FormItem::ckeditor')]])]);
    return $form;
});
开发者ID:ntamvl,项目名称:admin-3-demo,代码行数:15,代码来源:Form.php

示例6: array

    $form->ajax_validation(true);
    $form->items(array('Main' => array(FormItem::columns()->columns([[FormItem::text('title', 'Title')->validationRules('unique:pages,title,' . $id), FormItem::text('alias', 'Alias')->validationRules('unique:pages,alias,' . $id . ',id,context,' . Request::get('context', '')), FormItem::textarea('description', 'Description'), FormItem::chosen('tag', 'Tag')->model('App\\Tag')->display('lable')->multi(true)->nullable(), FormItem::icheckbox('active')->label('Active')->skin('flat')], [FormItem::bsselect('menu_id', 'Menu id')->options(App\Menu::getNestedList('level_lable'))->disableSort()->nullable(), FormItem::select('context', 'Context')->enum(config('jetcms.models.context')), FormItem::select('template', 'Template')->enum(config('jetcms.models.template.' . $model->context, []))->nullable()->disableSort(), FormItem::select('policies', 'Policies')->enum(config('jetcms.models.policies.' . $model->context, []))->nullable()->disableSort(), FormItem::bsselect('user_id', 'User')->model('App\\User')->display('email|id')->defaultValue(Sentinel::check()->id)->nullable(), FormItem::image('image', 'Image')]]), FormItem::images('gallery', 'Gallery')), 'Content' => [FormItem::ckeditor('content', 'Text')], 'Fields' => value(function () use($id, $model) {
        //if (!$model) {return array();}
        return [FormItem::custom()->display(function ($instance) use($model) {
            $str = null;
            foreach (config('jetcms.models.fields.' . $instance->context, array()) as $val) {
                $type = $val['type'];
                $input = FormItem::$type('field_array.' . $val['name'] . '', $val['lable']);
                $input->defaultValue($instance->field($val['name']));
                $str .= $input;
            }
            return $str;
        })->callback(function ($instance) {
            $instance->fieldArray = Request::input('field_array');
        })];
    }), 'Action' => [FormItem::custom()->display(function ($instance) {
        $str = null;
        foreach (config('jetcms.models.action.' . $instance->context, []) as $val) {
            $s = '<a class="btn btn-default btn-small" href="/' . config('admin.prefix') . '/' . $val['href'] . '">' . $val['lable'] . '</a> ';
            $s = str_replace(':id', $instance->id, $s);
            $str .= str_replace(':url', $instance->url, $s);
        }
        return $str;
    })]));
    return $form;
});
/**
 * Tags
 */
Admin::model('App\\Tag')->title('Tag')->alias('tags')->display(function () {
    $display = AdminDisplay::table();
开发者ID:jetcms,项目名称:models,代码行数:31,代码来源:JetCmsModels.php


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