本文整理匯總了PHP中PHUIPropertyListView::addImageContent方法的典型用法代碼示例。如果您正苦於以下問題:PHP PHUIPropertyListView::addImageContent方法的具體用法?PHP PHUIPropertyListView::addImageContent怎麽用?PHP PHUIPropertyListView::addImageContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHUIPropertyListView
的用法示例。
在下文中一共展示了PHUIPropertyListView::addImageContent方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$macro = id(new PhabricatorMacroQuery())->setViewer($user)->withIDs(array($this->id))->needFiles(true)->executeOne();
if (!$macro) {
return new Aphront404Response();
}
$file = $macro->getFile();
$title_short = pht('Macro "%s"', $macro->getName());
$title_long = pht('Image Macro "%s"', $macro->getName());
$actions = $this->buildActionView($macro);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->setActionList($actions);
$crumbs->addTextCrumb($title_short, $this->getApplicationURI('/view/' . $macro->getID() . '/'));
$properties = $this->buildPropertyView($macro, $actions);
if ($file) {
$file_view = new PHUIPropertyListView();
$file_view->addImageContent(phutil_tag('img', array('src' => $file->getViewURI(), 'class' => 'phabricator-image-macro-hero')));
}
$xactions = id(new PhabricatorMacroTransactionQuery())->setViewer($request->getUser())->withObjectPHIDs(array($macro->getPHID()))->execute();
$engine = id(new PhabricatorMarkupEngine())->setViewer($user);
foreach ($xactions as $xaction) {
if ($xaction->getComment()) {
$engine->addObject($xaction->getComment(), PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
}
}
$engine->process();
$timeline = id(new PhabricatorApplicationTransactionView())->setUser($user)->setObjectPHID($macro->getPHID())->setTransactions($xactions)->setMarkupEngine($engine);
$header = id(new PHUIHeaderView())->setUser($user)->setPolicyObject($macro)->setHeader($title_long);
if ($macro->getIsDisabled()) {
$header->addTag(id(new PHUITagView())->setType(PHUITagView::TYPE_STATE)->setName(pht('Macro Disabled'))->setBackgroundColor(PHUITagView::COLOR_BLACK));
}
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$comment_header = $is_serious ? pht('Add Comment') : pht('Grovel in Awe');
$draft = PhabricatorDraft::newFromUserAndKey($user, $macro->getPHID());
$add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($user)->setObjectPHID($macro->getPHID())->setDraft($draft)->setHeaderText($comment_header)->setAction($this->getApplicationURI('/comment/' . $macro->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
if ($file_view) {
$object_box->addPropertyList($file_view);
}
return $this->buildApplicationPage(array($crumbs, $object_box, $timeline, $add_comment_form), array('title' => $title_short));
}
示例2: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$macro = id(new PhabricatorMacroQuery())->setViewer($viewer)->withIDs(array($id))->needFiles(true)->executeOne();
if (!$macro) {
return new Aphront404Response();
}
$file = $macro->getFile();
$title_short = pht('Macro "%s"', $macro->getName());
$title_long = pht('Image Macro "%s"', $macro->getName());
$actions = $this->buildActionView($macro);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($title_short, $this->getApplicationURI('/view/' . $macro->getID() . '/'));
$properties = $this->buildPropertyView($macro, $actions);
if ($file) {
$file_view = new PHUIPropertyListView();
$file_view->addImageContent(phutil_tag('img', array('src' => $file->getViewURI(), 'class' => 'phabricator-image-macro-hero')));
}
$timeline = $this->buildTransactionTimeline($macro, new PhabricatorMacroTransactionQuery());
$header = id(new PHUIHeaderView())->setUser($viewer)->setPolicyObject($macro)->setHeader($title_long);
if (!$macro->getIsDisabled()) {
$header->setStatus('fa-check', 'bluegrey', pht('Active'));
} else {
$header->setStatus('fa-ban', 'red', pht('Archived'));
}
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$comment_header = $is_serious ? pht('Add Comment') : pht('Grovel in Awe');
$draft = PhabricatorDraft::newFromUserAndKey($viewer, $macro->getPHID());
$add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($macro->getPHID())->setDraft($draft)->setHeaderText($comment_header)->setAction($this->getApplicationURI('/comment/' . $macro->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
if ($file_view) {
$object_box->addPropertyList($file_view);
}
return $this->buildApplicationPage(array($crumbs, $object_box, $timeline, $add_comment_form), array('title' => $title_short, 'pageObjects' => array($macro->getPHID())));
}
示例3: buildImageCorpus
private function buildImageCorpus($file_uri)
{
$properties = new PHUIPropertyListView();
$properties->addImageContent(phutil_tag('img', array('src' => $file_uri)));
$file = $this->renderFileButton($file_uri);
$header = id(new PHUIHeaderView())->setHeader(pht('Image'))->addActionLink($file);
return id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
}
示例4: buildImageCorpus
private function buildImageCorpus($file_uri)
{
$properties = new PHUIPropertyListView();
$properties->addImageContent(phutil_tag('img', array('src' => $file_uri)));
$file = $this->renderFileButton($file_uri);
$header = id(new PHUIHeaderView())->setHeader(basename($this->getDiffusionRequest()->getPath()))->addActionLink($file)->setHeaderIcon('fa-file-image-o');
return id(new PHUIObjectBoxView())->setHeader($header)->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->addPropertyList($properties);
}