• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP GridField_FormAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中GridField_FormAction的典型用法代码示例。如果您正苦于以下问题:PHP GridField_FormAction类的具体用法?PHP GridField_FormAction怎么用?PHP GridField_FormAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了GridField_FormAction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getHTMLFragments

 /**
  * Place the print button in a <p> tag below the field
  *
  * @param GridField
  *
  * @return array
  */
 public function getHTMLFragments($gridField)
 {
     $button = new GridField_FormAction($gridField, 'print', _t('TableListField.Print', 'Print'), 'print', null);
     $button->setAttribute('data-icon', 'grid_print');
     $button->addExtraClass('gridfield-button-print');
     return array($this->targetFragment => '<p class="grid-print-button">' . $button->Field() . '</p>');
 }
开发者ID:jareddreyer,项目名称:catalogue,代码行数:14,代码来源:GridFieldPrintButton.php


示例2: getHTMLFragments

 /**
  * 
  * @param GridField $gridField
  * @return string - HTML
  */
 public function getHTMLFragments($gridField)
 {
     $searchState = $gridField->State->GridFieldSearchRelation;
     $dataClass = $gridField->getList()->dataClass();
     $forTemplate = new ArrayData(array());
     $forTemplate->Fields = new ArrayList();
     $searchFields = $this->getSearchFields() ? $this->getSearchFields() : $this->scaffoldSearchFields($dataClass);
     $value = $this->findSingleEntry($gridField, $searchFields, $searchState, $dataClass);
     $searchField = new TextField('gridfield_relationsearch', _t('GridField.RelationSearch', "Relation search"), $value);
     // Apparently the data-* needs to be double qouted for the jQuery.meta data plugin
     $searchField->setAttribute('data-search-url', '\'' . Controller::join_links($gridField->Link('search') . '\''));
     $searchField->setAttribute('placeholder', $this->getPlaceholderText($dataClass));
     $searchField->addExtraClass('relation-search no-change-track');
     $findAction = new GridField_FormAction($gridField, 'gridfield_relationfind', _t('GridField.Find', "Find"), 'find', 'find');
     $findAction->setAttribute('data-icon', 'relationfind');
     $addAction = new GridField_FormAction($gridField, 'gridfield_relationadd', _t('GridField.LinkExisting', "Link Existing"), 'addto', 'addto');
     $addAction->setAttribute('data-icon', 'chain--plus');
     // If an object is not found, disable the action
     if (!is_int($gridField->State->GridFieldAddRelation)) {
         $addAction->setReadonly(true);
     }
     $forTemplate->Fields->push($searchField);
     $forTemplate->Fields->push($findAction);
     $forTemplate->Fields->push($addAction);
     return array($this->targetFragment => $forTemplate->renderWith($this->itemClass));
 }
开发者ID:normann,项目名称:sapphire,代码行数:31,代码来源:GridFieldAddExistingAutocompleter.php


示例3: getHTMLFragments

 /**
  * Place the export button in a <p> tag below the field
  */
 public function getHTMLFragments($gridField)
 {
     $button = new GridField_FormAction($gridField, 'export', _t('TableListField.CSVEXPORT', 'Export to CSV'), 'export', null);
     $button->setAttribute('data-icon', 'download-csv');
     $button->addExtraClass('no-ajax');
     return array($this->targetFragment => '<p class="grid-csv-button">' . $button->Field() . '</p>');
 }
开发者ID:jareddreyer,项目名称:catalogue,代码行数:10,代码来源:GridFieldExportButton.php


示例4: getHTMLFragments

 public function getHTMLFragments($gridField)
 {
     $model = Injector::inst()->create($gridField->getModelClass());
     $parent = SiteTree::get()->byId(Controller::curr()->currentPageID());
     if (!$model->canCreate()) {
         return array();
     }
     $children = $this->getAllowedChildren($parent);
     if (count($children) > 1) {
         $pageTypes = DropdownField::create("PageType", "Page Type", $children, $model->defaultChild());
         $pageTypes->setFieldHolderTemplate("GridFieldSiteTreeAddNewButton_holder")->addExtraClass("gridfield-dropdown no-change-track");
         if (!$this->buttonName) {
             $this->buttonName = _t('GridFieldSiteTreeAddNewButton.AddMultipleOptions', 'Add new', "Add button text for multiple options.");
         }
     } else {
         $keys = array_keys($children);
         $pageTypes = HiddenField::create('PageType', 'Page Type', $keys[0]);
         if (!$this->buttonName) {
             $this->buttonName = _t('GridFieldSiteTreeAddNewButton.Add', 'Add new {name}', 'Add button text for a single option.', array($children[$keys[0]]));
         }
     }
     $state = $gridField->State->GridFieldSiteTreeAddNewButton;
     $state->currentPageID = $parent->ID;
     $state->pageType = $parent->defaultChild();
     $addAction = new GridField_FormAction($gridField, 'add', $this->buttonName, 'add', 'add');
     $addAction->setAttribute('data-icon', 'add')->addExtraClass("no-ajax ss-ui-action-constructive dropdown-action");
     $forTemplate = new ArrayData(array());
     $forTemplate->Fields = new ArrayList();
     $forTemplate->Fields->push($pageTypes);
     $forTemplate->Fields->push($addAction);
     Requirements::css(LUMBERJACK_DIR . "/css/lumberjack.css");
     Requirements::javascript(LUMBERJACK_DIR . "/javascript/GridField.js");
     return array($this->targetFragment => $forTemplate->renderWith("GridFieldSiteTreeAddNewButton"));
 }
开发者ID:micmania1,项目名称:silverstripe-lumberjack,代码行数:34,代码来源:GridFieldSiteTreeAddNewButton.php


示例5: getHTMLFragments

 public function getHTMLFragments($gridField)
 {
     $button = new GridField_FormAction($gridField, 'syncwithyoutube', _t('GridFieldSyncYoutubeVideos.CTA', 'Sync with Youtube'), 'syncwithyoutube', null);
     $button->setAttribute('data-icon', 'accept');
     $button->addExtraClass('no-ajax');
     return array($this->targetFragment => '<p class="grid-csv-button">' . $button->Field() . '<br><br></p>');
 }
开发者ID:helpfulrobot,项目名称:level51-silverstripe-youtubesync,代码行数:7,代码来源:GridFieldSyncYoutubeVideos.php


示例6: getHTMLFragments

 /**
  * Place the export button in a <p> tag below the field
  */
 public function getHTMLFragments($gridField)
 {
     $btnLabel = _t('Hail', 'Fetch {type}', ['type' => singleton($gridField->getModelClass())->i18n_plural_name()]);
     $button = new GridField_FormAction($gridField, 'fetchhail', $btnLabel, 'fetchhail', null);
     $button->setAttribute('data-icon', 'fetchHail');
     // $button->addExtraClass('ss-ui-action-constructive');
     return array($this->targetFragment => $button->Field());
 }
开发者ID:firebrandhq,项目名称:silverstripe-hail,代码行数:11,代码来源:GridFieldHailFetchButton.php


示例7: getHTMLFragments

 /**
  * Get the html/css button and upload field to perform import.
  */
 public function getHTMLFragments($gridField)
 {
     $button = new GridField_FormAction($gridField, 'import', _t('TableListField.CSVIMPORT', 'Import from CSV'), 'import', null);
     $button->setAttribute('data-icon', 'drive-upload');
     $button->addExtraClass('no-ajax');
     $uploadfield = $this->getUploadField($gridField);
     $data = array('Button' => $button, 'UploadField' => $uploadfield);
     $importerHTML = ArrayData::create($data)->renderWith("GridFieldImporter");
     Requirements::javascript('importexport/javascript/GridFieldImporter.js');
     return array($this->targetFragment => $importerHTML);
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-importexport,代码行数:14,代码来源:GridFieldImporter.php


示例8: getColumnContent

 public function getColumnContent($gridField, $record, $columnName)
 {
     Requirements::javascript(POSTMARK_RELATIVE_PATH . '/javascript/Messages.js');
     Requirements::css(POSTMARK_RELATIVE_PATH . '/css/GridFieldPostmarkMessageButton.css');
     $field = GridField_FormAction::create($gridField, 'MessageCustomer' . $record->ID, false, "message", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-pencil gird-field-message')->setAttribute('title', 'Message')->setAttribute('data-icon', 'envelope')->setDescription('Send Message');
     return $field->Field();
 }
开发者ID:helpfulrobot,项目名称:silverstripers-silverstripe-postmarked,代码行数:7,代码来源:GridFieldPostmarkMessageButton.php


示例9: getColumnContent

 /**
  *
  * @param \GridField $gridField
  * @param \DataObject $record
  * @param string $columnName
  * @return string|null - the HTML for the column
  */
 public function getColumnContent($gridField, $record, $columnName)
 {
     if (!$record instanceof \Payment) {
         return null;
     }
     if (!$record->canRefund()) {
         return null;
     }
     \Requirements::css('omnipay-ui/css/omnipay-ui-cms.css');
     \Requirements::javascript('omnipay-ui/javascript/omnipay-ui-cms.js');
     \Requirements::add_i18n_javascript('omnipay-ui/javascript/lang');
     $infoText = '';
     switch (GatewayInfo::refundMode($record->Gateway)) {
         case GatewayInfo::MULTIPLE:
             $infoText = 'MultiRefundInfo';
             break;
         case GatewayInfo::PARTIAL:
             $infoText = 'SingleRefundInfo';
             break;
         case GatewayInfo::FULL:
             $infoText = 'FullRefundInfo';
             break;
     }
     /** @var \Money $money */
     $money = $record->dbObject('Money');
     /** @var \GridField_FormAction $field */
     $field = \GridField_FormAction::create($gridField, 'RefundPayment' . $record->ID, false, 'refundpayment', array('RecordID' => $record->ID))->addExtraClass('gridfield-button-refund payment-dialog-button')->setAttribute('title', _t('GridFieldRefundAction.Title', 'Refund Payment'))->setAttribute('data-icon', 'button-refund')->setAttribute('data-dialog', json_encode(array('maxAmount' => $money->Nice(), 'maxAmountNum' => $money->getAmount(), 'hasAmountField' => $record->canRefund(null, true), 'infoTextKey' => $infoText, 'buttonTextKey' => 'RefundAmount')))->setDescription(_t('GridFieldRefundAction.Description', 'Refund a captured payment'));
     return $field->Field();
 }
开发者ID:bummzack,项目名称:silverstripe-omnipay-ui,代码行数:36,代码来源:GridFieldRefundAction.php


示例10: getColumnContent

 public function getColumnContent($gridField, $record, $columnName)
 {
     $link = $gridField->getForm()->getController()->Link("edit");
     $target = $gridField->getForm()->getRecord();
     $field = GridField_FormAction::create($gridField, 'Select' . $record->ID, 'Select', "doselect", array("RecordClassName" => $record->ClassName, "RecordID" => $record->ID, "TargetClassName" => $target->ClassName, "TargetID" => $target->ID, "Redirect" => $link))->addExtraClass("ss-ui-action-constructive");
     return $field->Field();
 }
开发者ID:i-lateral,项目名称:silverstripe-orders,代码行数:7,代码来源:GridFieldMapExistingAction.php


示例11: getHTMLFragments

 /**
  * Returns a map where the keys are fragment names and the values are pieces of HTML to add to these fragments.
  * @param GridField $gridField Grid Field Reference
  * @return Array Map where the keys are fragment names and the values are pieces of HTML to add to these fragments.
  */
 public function getHTMLFragments($gridField)
 {
     $dataList = $gridField->getList();
     if (class_exists('UnsavedRelationList') && $dataList instanceof UnsavedRelationList) {
         return array();
     }
     $state = $gridField->State->GridFieldSortableRows;
     if (!is_bool($state->sortableToggle)) {
         $state->sortableToggle = false;
     }
     //Ensure user can edit
     if (!singleton($gridField->getModelClass())->canEdit()) {
         return array();
     }
     //Sort order toggle
     $sortOrderToggle = GridField_FormAction::create($gridField, 'sortablerows-toggle', 'sorttoggle', 'sortableRowsToggle', null)->addExtraClass('sortablerows-toggle');
     $sortOrderSave = GridField_FormAction::create($gridField, 'sortablerows-savesort', 'savesort', 'saveGridRowSort', null)->addExtraClass('sortablerows-savesort');
     //Sort to Page Action
     $sortToPage = GridField_FormAction::create($gridField, 'sortablerows-sorttopage', 'sorttopage', 'sortToPage', null)->addExtraClass('sortablerows-sorttopage');
     $data = array('SortableToggle' => $sortOrderToggle, 'SortOrderSave' => $sortOrderSave, 'SortToPage' => $sortToPage, 'Checked' => $state->sortableToggle == true ? ' checked = "checked"' : '', 'List' => $dataList);
     $forTemplate = new ArrayData($data);
     //Inject Requirements
     $custom = Config::inst()->get('GridFieldSortableRows', 'Base');
     $base = $custom ?: SORTABLE_GRIDFIELD_BASE;
     Requirements::css($base . '/css/GridFieldSortableRows.css');
     Requirements::javascript($base . '/javascript/GridFieldSortableRows.js');
     $args = array('Colspan' => count($gridField->getColumns()), 'ID' => $gridField->ID(), 'DisableSelection' => $this->disable_selection);
     $fragments = array('header' => $forTemplate->renderWith('GridFieldSortableRows', $args));
     if ($gridField->getConfig()->getComponentByType('GridFieldPaginator')) {
         $fragments['after'] = $forTemplate->renderWith('GridFieldSortableRows_paginator');
     }
     return $fragments;
 }
开发者ID:helpfulrobot,项目名称:maldicore-sortablegridfield,代码行数:38,代码来源:GridFieldSortableRows.php


示例12: getColumnContent

 /**
  *
  * @param GridField $gridField
  * @param DataObject $record
  * @param string $columnName
  * @return string - the HTML for the column
  */
 public function getColumnContent($gridField, $record, $columnName)
 {
     if ($this->removeRelation) {
         $field = GridField_FormAction::create($gridField, 'UnlinkRelation' . $record->ID, false, "unlinkrelation", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-unlink')->setAttribute('title', _t('GridAction.UnlinkRelation', "Unlink"))->setAttribute('data-icon', 'chain--minus');
     } else {
         if (!$record->canDelete()) {
             return;
         }
         $field = GridField_FormAction::create($gridField, 'DeleteRecord' . $record->ID, false, "deleterecord", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-delete')->setAttribute('title', _t('GridAction.Delete', "Delete"))->setAttribute('data-icon', 'cross-circle')->setDescription(_t('GridAction.DELETE_DESCRIPTION', 'Delete'));
     }
     //add a class to the field to if it is the last gridfield in the list
     $numberOfRelations = $record->Pages()->Count();
     $field->addExtraClass('dms-delete')->setAttribute('data-pages-count', $numberOfRelations)->removeExtraClass('gridfield-button-delete');
     //remove the base gridfield behaviour
     //set a class telling JS what kind of warning to display when clicking the delete button
     if ($numberOfRelations > 1) {
         $field->addExtraClass('dms-delete-link-only');
     } else {
         $field->addExtraClass('dms-delete-last-warning');
     }
     //set a class to show if the document is hidden
     if ($record->isHidden()) {
         $field->addExtraClass('dms-document-hidden');
     }
     return $field->Field();
 }
开发者ID:helpfulrobot,项目名称:silverstripe-dms,代码行数:33,代码来源:DMSGridFieldDeleteAction.php


示例13: getColumnContent

 /**
  * @param GridField $gridField
  * @param DataObject $record
  * @param string $columnName
  * @return string - the HTML for the column
  */
 public function getColumnContent($gridField, $record, $columnName)
 {
     if (!$record->canDelete()) {
         return;
     }
     $field = GridField_FormAction::create($gridField, 'SoftDeleteRecord' . $record->ID, false, "softdeleterecord", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-delete')->setAttribute('title', _t('GridAction.Delete', "Delete"))->setAttribute('data-icon', 'cross-circle')->setDescription(_t('GridAction.DELETE_DESCRIPTION', 'Delete'));
     return $field->Field();
 }
开发者ID:lekoala,项目名称:silverstripe-softdelete,代码行数:14,代码来源:GridFieldSoftDeleteAction.php


示例14: getColumnContent

 public function getColumnContent($gridField, $record, $columnName)
 {
     if (!$record->canCreate()) {
         return;
     }
     $field = GridField_FormAction::create($gridField, 'CopyRecord' . $record->ID, false, "copyrecord", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-copy')->setAttribute('title', _t('GridAction.Copy', "Copy"))->setDescription(_t('GridAction.COPY_DESCRIPTION', 'Copy'));
     return $field->Field();
 }
开发者ID:unisolutions,项目名称:silverstripe-copybutton,代码行数:8,代码来源:GridFieldCopyButton.php


示例15: getColumnContent

 public function getColumnContent($gridField, $record, $columnName)
 {
     $template = $gridField->getList()->byID($record->ID);
     $title = 'Clone Template';
     $icon = 'drive-upload';
     $field = GridField_FormAction::create($gridField, GridFieldCloneSurveyTemplateAction::ACTION_NAME . $record->ID, false, GridFieldCloneSurveyTemplateAction::ACTION_NAME, array('RecordID' => $record->ID))->setAttribute('title', $title)->setAttribute('data-icon', $icon)->setDescription($title);
     return $field->Field();
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:8,代码来源:GridFieldCloneSurveyTemplateAction.php


示例16: getColumnContent

 /**
  *
  * @param GridField $gridField
  * @param DataObject $record
  * @param string $columnName
  * @return string - the HTML for the column
  */
 public function getColumnContent($gridField, $record, $columnName)
 {
     if (!$record->IsDeletedFromStage && $record->canDelete() && !$record->isPublished()) {
         $field = GridField_FormAction::create($gridField, 'DeleteFromStage' . $record->ID, false, "deletefromstage", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-deletedraft')->setAttribute('title', _t('PublishableGridFieldAction.DELETE', 'Delete draft'))->setAttribute('data-icon', 'decline')->setDescription(_t('PublishableGridFieldAction.DELETE_DESC', 'Remove this item from the draft site'));
         return $field->Field();
     }
     return;
 }
开发者ID:helpfulrobot,项目名称:studiobonito-silverstripe-publishable,代码行数:15,代码来源:PublishableGridFieldDeleteAction.php


示例17: getHTMLFragments

 public function getHTMLFragments($gridField)
 {
     Requirements::css(FindManyManyDropdown_PATH . '/css/FindManyManyDropdown.css');
     Requirements::javascript(FindManyManyDropdown_PATH . '/javascript/FindManyManyDropdownForm.js');
     $targetFragment = 'before';
     if ($gridField->getConfig()->getComponentByType('GridFieldButtonRow')) {
         $targetFragment = 'buttons-before-right';
     }
     $dataClass = $gridField->list->dataClass;
     $dropdownOptions = new DropdownField('gridfield_relationdropdown', 'Please choose an object', Dataobject::get($dataClass)->map("ID", "Title"));
     $dropdownOptions->setEmptyString('Select:');
     $addAction = new GridField_FormAction($gridField, 'gridfield_relationadd', _t('GridField.LinkExisting', "Link Existing"), 'addDDto', 'addDDto');
     $addAction->setAttribute('data-icon', 'chain--plus');
     $forTemplate = new ArrayData(array());
     $forTemplate->Fields = new ArrayList();
     $forTemplate->Fields->push($dropdownOptions);
     $forTemplate->Fields->push($addAction);
     return array($targetFragment => $forTemplate->renderWith('FindManyManyDropdownForm'));
 }
开发者ID:helpfulrobot,项目名称:jonshutt-find-many-many-dropdown,代码行数:19,代码来源:FindManyManyDropdown.php


示例18: getColumnContent

 public function getColumnContent($gridField, $record, $columnName)
 {
     if (!$record->canEdit()) {
         return;
     }
     $member = $gridField->getList()->byID($record->ID);
     $title = $member->Active ? "Deactivate Member" : "Activate Member";
     $icon = $member->Active ? 'accept' : 'accept_disabled';
     $field = GridField_FormAction::create($gridField, 'activatemember' . $record->ID, false, "activatemember", array('RecordID' => $record->ID))->setAttribute('title', $title)->setAttribute('data-icon', $icon)->setDescription($title);
     return $field->Field();
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:11,代码来源:GridFieldActivateMemberAction.php


示例19: getColumnContent

 public function getColumnContent($gridField, $record, $columnName)
 {
     if (!$record->canEdit()) {
         return;
     }
     $summit_event = $gridField->getList()->byID($record->ID);
     $title = $summit_event->Published ? "Unpublish Event" : "Publish Event";
     $icon = $summit_event->Published ? 'accept' : 'accept_disabled';
     $field = GridField_FormAction::create($gridField, 'publishsummitevent' . $record->ID, false, "publishsummitevent", array('RecordID' => $record->ID))->setAttribute('title', $title)->setAttribute('data-icon', $icon)->setDescription($title);
     return $field->Field();
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:11,代码来源:GridFieldPublishSummitEventAction.php


示例20: getHTMLFragments

 /**
  * @inheritdoc
  *
  * Create the split button with all the export options.
  *
  * @param  GridField $gridField
  * @return array
  */
 public function getHTMLFragments($gridField)
 {
     // Set up the split button
     $splitButton = new SplitButton('Export', 'Export');
     $splitButton->setAttribute('data-icon', 'download-csv');
     // XLSX option
     $button = new GridField_FormAction($gridField, 'xlsxexport', _t('firebrandhq.EXCELEXPORT', 'Export to Excel (XLSX)'), 'xlsxexport', null);
     $button->addExtraClass('no-ajax');
     $splitButton->push($button);
     // XLS option
     $button = new GridField_FormAction($gridField, 'xlsexport', _t('firebrandhq.EXCELEXPORT', 'Export to Excel (XLS)'), 'xlsexport', null);
     $button->addExtraClass('no-ajax');
     $splitButton->push($button);
     // CSV option
     $button = new GridField_FormAction($gridField, 'csvexport', _t('firebrandhq.EXCELEXPORT', 'Export to CSV'), 'csvexport', null);
     $button->addExtraClass('no-ajax');
     $splitButton->push($button);
     // Return the fragment
     return array($this->targetFragment => $splitButton->Field());
 }
开发者ID:helpfulrobot,项目名称:firebrandhq-silverstripe-excel-export,代码行数:28,代码来源:GridFieldExcelExportButton.php



注:本文中的GridField_FormAction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP GridHandler类代码示例发布时间:2022-05-23
下一篇:
PHP GridFieldConfig_RelationEditor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap