0
我有一個建立菜單的模塊。我想添加css類到模塊生成的<a>
標籤。我使用dpm()
來找到我需要添加我的類的正確數組。這是Drupal:如何正確添加一個'類'數組到一個元素的'屬性'數組?
['#localized_options']['attributes']
已經有一個[title]
排列在那裏,但沒有數組類。
我試着將我的班了幾個不同的方式,因爲這樣的:
$item['#localized_options']['attributes']['class'] = "some-styles";
$item['#localized_options']['attributes']['class'][] = "some-styles";
$item['#localized_options']['attributes'] = array('class' => "some-styles");
但我不斷收到錯誤:
Fatal error: Cannot use string offset as an array
會有人一個知道我應該怎麼做這個?