public function render_active() { $self = $this; return Tart::to_sentence(array_values(array_filter(array_map(function ($entry) use($self) { if (!$entry->active()) { return NULL; } $data = $self->data(); unset($data[$entry->name()]); return HTML::anchor(Tart::uri($self->controller()) . URL::query(array_filter($data), FALSE), $entry->active(), array('class' => 'label')); }, $this->entries())))); }
/** * @dataProvider data_to_sentence */ public function test_to_sentence($array, $expected_string) { $this->assertEquals($expected_string, Tart::to_sentence($array)); }
public static function to_modifications(array $modified) { foreach ($modified as $key => &$value) { $value = Inflector::humanize($key) . (is_array($value) ? ': ' . Tart_Request::to_modifications($value) : ($value ? ' set to "' . $value . '"' : ' cleared')); } return Tart::to_sentence(array_values($modified)); }