簡體   English   中英

奏鳴曲為田野上色

[英]sonata color the fields

我想了解奏鳴曲的工作原理,我有一個問題。 我看到了有關他們的演示的一些不錯的信息,但是找不到他們喜歡的文檔。 也許你可以幫我。

在字段中,它們肯定會根據我想知道的顏色標准確定顏色值。 我在他們的網站上放了一個小屏幕,可以幫助您了解我的要求。 多彩的田野

我有一個小的表格,我也放置了代碼,我希望能夠將綠色的“客戶端”塗成紅色的“前客戶端”,將藍色塗成“潛在客戶”,我該怎么辦?

protected function configureFormFields(FormMapper $formMapper)
{
    $formMapper
        ->tab('General Information',array('class'=>'col-md-9'))
        ->with('', array('class'=>'col-md-9'))
        ->add('firstName', 'text')
        ->add('surname', 'text')
        ->add('address', 'text',array('required'=> false))
        ->add('email', 'email', array(
            'required' => false))
        ->add('Phone', 'text', array(
            'required' => false))
        ->add('birthdate', 'birthday', array('label' => 'Date of Birth','required'=>false))
        ->end()
        ->with('Others Informations',array('class'=>'col-md-3'))
        ->add('Status', 'choice', array(
            'choices' => array(
                'Client' => 'Client',
                'Ex-Client' => 'Ex-Client',
                'Prospect' => 'Prospect'),
        ))
        ->add('businessname', 'text', array('label' => 'Business Name','required'=>false))
        ->add('typeofbusiness', 'choice', array(
            'choices' => array(
                'Blank' => Null,
                'SE' => 'SE',
                'SA' => 'SA',
                'LLP' => 'LLP',
                'LTD' => 'LTD',
                'Payroll' => 'Payroll'),
            'label' => 'Type of buisness'
        ))
        ->end()
        ->end()
        ->tab('Comment',array('class'=>'col-md-12'))
        ->add('comments', 'textarea', array('required'=>false))
        ->end()
    ;
}



protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
    $datagridMapper
        ->add('surname')
        ->add('firstname')
        ->add('address')
        ->add('email')
        ->add('phone')
        ->add('birthdate', null, array(
            'label' => 'Date of birth (mm/dd/yyyy)'), 'sonata_type_datetime_picker', array(
            'format'                => 'MM/dd/yyyy',
            'dp_side_by_side'       => true,
            'dp_use_current'        => false,
            'dp_use_seconds'        => false,
        ))
        ->add('status')
        ->add('businessname')
        ->add('typeofbusiness')
        ->add('comments')
    ;

}

protected function configureListFields(ListMapper $listMapper)
{
    $listMapper
        ->addIdentifier('surname')
        ->add('firstname')
        ->add('address')
        ->add('email')
        ->add('phone')
        ->add('birthdate')
        ->add('Status')
        ->add('businessname')
        ->add('typeofbusiness')
        ->add('comments');
}

public function toString($object)
{
    return $object instanceof Client
        ? $object->getSurname()
        : 'Client'; // shown in the breadcrumb on the create view
}

}

同樣在安裝和抓地力方面,它們使我們創建了BlogPost,但我在哪里都未定義任何內容,布爾值用紅色或綠色表示。 我真的不明白該怎么做。

您可以通過為您的字段創建自定義模板來做到這一點

參見此處: https : //sonata-project.org/bundles/doctrine-orm-admin/master/doc/reference/list_field_definition.html#custom-template

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM