本文整理匯總了PHP中CustomField::setScreen方法的典型用法代碼示例。如果您正苦於以下問題:PHP CustomField::setScreen方法的具體用法?PHP CustomField::setScreen怎麽用?PHP CustomField::setScreen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CustomField
的用法示例。
在下文中一共展示了CustomField::setScreen方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
/**
* Delete custom fields
* @param $request
* @return unknown_type
*/
public function execute($request)
{
$admin = $this->getUser()->hasCredential(Auth::ADMIN_ROLE);
if (!$admin) {
$this->forward("auth", "unauthorized");
return;
}
$form = new CustomFieldForm(array(), array(), true);
$customFieldsService = $this->getCustomFieldService();
if ($request->isMethod('post')) {
$form->bind($request->getParameter($form->getName()));
if ($form->isValid()) {
$fieldNum = $form->getValue('field_num');
$customField = null;
if (isset($fieldNum)) {
$customField = $customFieldsService->getCustomField($fieldNum);
}
if (empty($customField)) {
$customField = new CustomField();
}
$customField->setName($form->getValue('name'));
$customField->setType($form->getValue('type'));
$customField->setScreen($form->getValue('screen'));
$customField->setExtraData($form->getValue('extra_data'));
$customFieldsService->saveCustomField($customField);
$this->getUser()->setFlash('templateMessage', array('success', __(TopLevelMessages::SAVE_SUCCESS)));
}
}
$this->redirect('pim/listCustomFields');
}
示例2: testSaveCustomField
public function testSaveCustomField()
{
$customField = new CustomField();
$customField->setName('Hobby');
$customField->setType(0);
$customField->setScreen('personal');
$result = $this->customFieldConfigurationDao->saveCustomField($customField);
$this->assertTrue($result instanceof CustomField);
$this->assertEquals('Hobby', $result->getName());
$this->assertEquals(6, $result->getId());
}