public static function renderField(Property $property) { $description = (string) $property->getDescription(); $settings = ['type' => static::getFieldType($property), 'field' => $property->getVariableName(), 'label' => static::removeJson($description), 'columns' => '12', 'attributes' => ['class' => 'text']]; $isCollection = static::isCollection($property); if ($isCollection) { $settings['add_more'] = true; } $isScoped = static::isScopedRelationship($property); if ($isScoped) { $variableName = $property->getVariableName(); $settings['scope'] = static::$object->getFieldType($variableName)->getScope(); } $hasJson = static::hasJsonString((string) $description); if ($hasJson) { $settings = wp_parse_args($hasJson, $settings); } piklist('field', $settings); }
/** * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ public function testHasDescription() { $expected = new Description('Description'); $fixture = new Property('1.0', null, $expected); $this->assertSame($expected, $fixture->getDescription()); }