本文整理汇总了PHP中GridField::getColumnMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP GridField::getColumnMetadata方法的具体用法?PHP GridField::getColumnMetadata怎么用?PHP GridField::getColumnMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridField
的用法示例。
在下文中一共展示了GridField::getColumnMetadata方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHTMLFragments
/**
* @param GridField $grid
* @return array
*/
public function getHTMLFragments($grid)
{
$cols = new ArrayList();
foreach ($grid->getColumns() as $name) {
$meta = $grid->getColumnMetadata($name);
$cols->push(new ArrayData(array('Name' => $name, 'Title' => $meta['title'])));
}
$days = new ArrayList();
for ($i = 0; $i < 5; $i++) {
$date = new Date();
$date->setValue(date('d-m-Y', strtotime('+' . $i . ' days', strtotime($this->startDate))));
$isHoliday = in_array($date->Format('Y-m-d'), $this->holidays);
$days->push(new ArrayData(array('Day' => $date->Format('l'), 'IsHoliday' => $isHoliday)));
}
return array('header' => $cols->renderWith('RosterGridFieldTitleHeader', array('StartDate' => $this->startDate, 'Days' => $days)));
}
开发者ID:helpfulrobot,项目名称:danae-miller-clendon-silverstripe-roster,代码行数:20,代码来源:RosterGridFieldTitleHeader.php
示例2: testGetColumnMetadataBadArguments
/**
* @covers GridField::getColumnMetadata
*/
public function testGetColumnMetadataBadArguments()
{
$this->setExpectedException('InvalidArgumentException');
$list = ArrayList::create();
$config = GridFieldConfig::create()->addComponent(new GridFieldTest_Component());
$obj = new GridField('testfield', 'testfield', $list, $config);
$obj->getColumnMetadata('non-exist-qweqweqwe');
}