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
会有人一个知道我应该怎么做这个?