2015-08-13 57 views
-3

我找不到機會單獨定製的單選按鈕的屬性,因爲我要插入一個title標籤和data-toggle="tooltip"對每一個單選按鈕顯示工具提示Symfony2的personnalisation ATTR單選按鈕

$builder 
     ->add('type', 'choice', array(
      'choices' => array(
       '0' => 'Demande', // Here personnalise attr 
       '1' => 'Recherche', // Here personnalise attr 
      ), 
      'expanded' => true, 
     )) 

謝謝!

+0

提供了'attr'選項將更多的選擇領域將呈現上的複選框元素的屬性。 – user2268997

+0

不,這是不是我想要做的這個代碼,因爲我將有兩個單選按鈕相同的標題標籤......但我想要做的是爲每個單選按鈕有一個不同的標題標籤 – user3862097

回答

0

使用ATTR選項:

$builder 
     ->add('type', 'choice', array(
      'choices' => array(
       '0' => 'Demande', // Here personnalise attr 
       '1' => 'Recherche', // Here personnalise attr 
      ), 
      'expanded' => true, 
      'attr' => array(
       'data-toggle' => 'tooltip', 
       'title' => 'a title' 
      ), 
     )) 
+0

不,這不是我想用這個代碼做什麼,因爲我將有兩個單選按鈕的相同標題標籤......但是我想要做的是爲每個單選按鈕設置不同的標題標籤 – user3862097