当前位置: 首页>>代码示例>>PHP>>正文


PHP Requirements::add_i18n_javascript方法代码示例

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


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

示例1: FieldHolder

	function FieldHolder() {
		
		
		Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js');
		Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
		Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js');
		Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js');
		Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
		Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableListField.js');
		
		// swap the js file
		Requirements::block(SAPPHIRE_DIR . '/javascript/TableField.js');
		Requirements::javascript('modifiedtablefield/javascript/ModifiedTableField.js');
		
		
		Requirements::css(SAPPHIRE_DIR . '/css/TableListField.css');
		

		$defaults = $this->fieldDefaults;
		if ($this->fieldDefaults == null && !is_array($this->fieldDefaults)) {
			$sourceClass = $this->sourceClass;
			
			$defaults = singleton($sourceClass)->stat('defaults');
		}
		
		if (count($defaults) > 0) {
			Requirements::customScript("var ".$this->name."_fieldDefaults = ".Convert::array2json($defaults));
		}
		
		
		return $this->renderWith($this->template);
	}
开发者ID:nathancox,项目名称:silverstripe-modifiedtablefield,代码行数:32,代码来源:ModifiedTableField.php

示例2: Field

    function Field()
    {
        Requirements::javascript(THIRDPARTY_DIR . "/prototype.js");
        Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js");
        Requirements::javascript(THIRDPARTY_DIR . "/prototype_improvements.js");
        Requirements::css(SAPPHIRE_DIR . '/css/TreeDropdownField.css');
        Requirements::javascript(THIRDPARTY_DIR . "/tree/tree.js");
        Requirements::css(THIRDPARTY_DIR . "/tree/tree.css");
        Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
        Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js");
        if ($this->value) {
            $record = $this->getByKey($this->value);
            $title = $record ? $record->Title : _t('DropdownField.CHOOSE', "(Choose)", PR_MEDIUM, 'Start-value of a dropdown');
        } else {
            $title = _t('DropdownField.CHOOSE', "(Choose)", PR_MEDIUM, 'Start-value of a dropdown');
        }
        $id = $this->id();
        $classes = "TreeDropdownField single";
        if ($this->extraClass()) {
            $classes .= ' ' . $this->extraClass();
        }
        return <<<HTML
\t\t\t<div  id="TreeDropdownField_{$id}" class="{$classes}"><input id="{$id}" type="hidden" name="{$this->name}" value="{$this->value}" /><span class="items">{$title}</span><a href="#" title="open" class="editLink">&nbsp;</a></div>\t\t
HTML;
    }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:25,代码来源:TreeDropdownField.php

示例3: init

 function init()
 {
     parent::init();
     // somehow themed css gets mixed in, remove it
     $reqbe = Requirements::backend();
     foreach ($reqbe->get_css() as $file => $val) {
         if (preg_match('/^themes\\//', $file)) {
             Requirements::block($file);
         }
     }
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-form/jquery.form.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.core.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.widget.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.mouse.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.tabs.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.button.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.position.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.dialog.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.draggable.js');
     Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.core.css');
     Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.dialog.css');
     Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.theme.css');
     Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.tabs.css');
     Requirements::clear('jsparty/prototype.js');
     Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
     Requirements::add_i18n_javascript('dbplumber/javascript/lang');
     Requirements::javascript("dbplumber/javascript/DatabaseBrowser.js");
     Requirements::javascript("dbplumber/thirdparty/jquery.event.drag-1.4.js");
     Requirements::javascript("dbplumber/thirdparty/jquery.kiketable.colsizable-1.1.js");
     Requirements::javascript("dbplumber/thirdparty/jquery.textarea-expander.js");
     Requirements::css("dbplumber/thirdparty/jquery.kiketable.colsizable-1.1.css");
     Requirements::css("dbplumber/css/DatabaseBrowser_left.css");
     Requirements::css("dbplumber/css/DatabaseBrowser_right.css");
 }
开发者ID:alapini,项目名称:silverstripe-dbplumber,代码行数:35,代码来源:DatabaseBrowser.php

示例4: updateCMSFields

 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     Requirements::add_i18n_javascript(ADVANCED_WORKFLOW_DIR . '/javascript/lang');
     // Add timepicker functionality
     // @see https://github.com/trentrichardson/jQuery-Timepicker-Addon
     Requirements::css(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.css');
     Requirements::css(ADVANCED_WORKFLOW_DIR . '/css/WorkflowCMS.css');
     Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js');
     Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.js');
     Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/javascript/WorkflowField.js');
     $this->setIsWorkflowInEffect();
     $fields->findOrMakeTab('Root.PublishingSchedule', _t('WorkflowEmbargoExpiryExtension.TabTitle', 'Publishing Schedule'));
     if ($this->getIsWorkflowInEffect()) {
         $fields->addFieldsToTab('Root.PublishingSchedule', array(HeaderField::create('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), LiteralField::create('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = Datetimefield::create('DesiredPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE', 'Requested publish date')), $ut = Datetimefield::create('DesiredUnPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_UNPUBLISH_DATE', 'Requested un-publish date')), Datetimefield::create('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date'))->setDisabled(true), Datetimefield::create('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date'))->setDisabled(true)));
     } else {
         $fields->addFieldsToTab('Root.PublishingSchedule', array(HeaderField::create('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), LiteralField::create('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = Datetimefield::create('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date')), $ut = Datetimefield::create('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date'))));
     }
     $dt->getDateField()->setConfig('showcalendar', true);
     $ut->getDateField()->setConfig('showcalendar', true);
     $dt->getTimeField()->setConfig('timeformat', 'HH:mm:ss');
     $ut->getTimeField()->setConfig('timeformat', 'HH:mm:ss');
     // Enable a jQuery-UI timepicker widget
     if (self::$showTimePicker) {
         $dt->getTimeField()->addExtraClass('hasTimePicker');
         $ut->getTimeField()->addExtraClass('hasTimePicker');
     }
 }
开发者ID:Neumes,项目名称:advancedworkflow,代码行数:30,代码来源:WorkflowEmbargoExpiryExtension.php

示例5: getPopupRequirements

 public function getPopupRequirements()
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-metadata/jquery.metadata.js');
     Requirements::add_i18n_javascript('eventlocations/javascript/lang');
     Requirements::javascript('eventlocations/javascript/LocationDateTimeCms.js');
 }
开发者ID:nyeholt,项目名称:silverstripe-eventlocations,代码行数:7,代码来源:LocationDateTimeExtension.php

示例6: getHTMLFragments

 /**
  * @param GridField $gridField
  *
  * @return array
  */
 public function getHTMLFragments($gridField)
 {
     Requirements::css(CMC_BULKUPDATER_MODULE_DIR . '/css/CmcGridFieldBulkUpdater.css');
     Requirements::javascript(CMC_BULKUPDATER_MODULE_DIR . '/javascript/CmcGridFieldBulkUpdater.js');
     Requirements::add_i18n_javascript(CMC_BULKUPDATER_MODULE_DIR . '/lang/js');
     //initialize column data
     $cols = new ArrayList();
     $fields = $gridField->getConfig()->getComponentByType('GridFieldEditableColumns')->getDisplayFields($gridField);
     foreach ($gridField->getColumns() as $col) {
         $fieldName = $col;
         $fieldType = '';
         $fieldLabel = '';
         if (isset($fields[$fieldName])) {
             $fieldData = $fields[$fieldName];
             if (isset($fieldData['field'])) {
                 $fieldType = $fieldData['field'];
             }
             if (isset($fieldData['title'])) {
                 $fieldLabel = $fieldData['title'];
             }
         }
         //Debug::show($fieldType);
         if (class_exists($fieldType) && $fieldType != 'ReadonlyField') {
             $field = new $fieldType($fieldName, $fieldLabel);
             if ($fieldType == 'DatetimeField' || $fieldType == 'DateField' || $fieldType == 'TimeField') {
                 $field->setValue(date('Y-m-d H:i:s'));
                 $field->setConfig('showcalendar', true);
             }
             $cols->push(new ArrayData(array('UpdateField' => $field, 'Name' => $fieldName, 'Title' => $fieldLabel)));
         } else {
             $meta = $gridField->getColumnMetadata($col);
             $cols->push(new ArrayData(array('Name' => $col, 'Title' => $meta['title'])));
         }
     }
     $templateData = array();
     if (!count($this->config['actions'])) {
         user_error('Trying to use GridFieldBulkManager without any bulk action.', E_USER_ERROR);
     }
     //set up actions
     $actionsListSource = array();
     $actionsConfig = array();
     foreach ($this->config['actions'] as $action => $actionData) {
         $actionsListSource[$action] = $actionData['label'];
         $actionsConfig[$action] = $actionData['config'];
     }
     reset($this->config['actions']);
     $firstAction = key($this->config['actions']);
     $dropDownActionsList = DropdownField::create('bulkActionName', '')->setSource($actionsListSource)->setAttribute('class', 'bulkActionName no-change-track')->setAttribute('id', '');
     //initialize buttonLabel
     $buttonLabel = _t('CMC_GRIDFIELD_BULK_UPDATER.ACTION1_BTN_LABEL', $this->config['actions'][$firstAction]['label']);
     //add menu if more than one action
     if (count($this->config['actions']) > 1) {
         $templateData = array('Menu' => $dropDownActionsList->FieldHolder());
         $buttonLabel = _t('CMC_GRIDFIELD_BULK_UPDATER.ACTION_BTN_LABEL', 'Go');
     }
     //Debug::show($buttonLabel);
     $templateData = array_merge($templateData, array('Button' => array('Label' => $buttonLabel, 'Icon' => $this->config['actions'][$firstAction]['config']['icon']), 'Select' => array('Label' => _t('CMC_GRIDFIELD_BULK_UPDATER.SELECT_ALL_LABEL', 'Select all')), 'Colspan' => count($gridField->getColumns()) - 1, 'Cols' => $cols));
     $templateData = new ArrayData($templateData);
     return array('header' => $templateData->renderWith('CmcBulkUpdaterButtons'));
 }
开发者ID:cmcramer,项目名称:cmc-silverstripe-gridfieldbulkupdater,代码行数:65,代码来源:CmcGridFieldBulkUpdater.php

示例7: init

	public function init() {
		// set reading lang
		if(Object::has_extension('SiteTree', 'Translatable') && !$this->request->isAjax()) {
			Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree')));
		}
		
		parent::init();
		
		Requirements::css(CMS_DIR . '/css/screen.css');
		
		Requirements::combine_files(
			'cmsmain.js',
			array_merge(
				array(
					CMS_DIR . '/javascript/CMSMain.js',
					CMS_DIR . '/javascript/CMSMain.EditForm.js',
					CMS_DIR . '/javascript/CMSMain.AddForm.js',
					CMS_DIR . '/javascript/CMSPageHistoryController.js',
					CMS_DIR . '/javascript/CMSMain.Tree.js',
					CMS_DIR . '/javascript/SilverStripeNavigator.js'
				),
				Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', true, true)
			)
		);

		CMSBatchActionHandler::register('publish', 'CMSBatchAction_Publish');
		CMSBatchActionHandler::register('unpublish', 'CMSBatchAction_Unpublish');
		CMSBatchActionHandler::register('delete', 'CMSBatchAction_Delete');
		CMSBatchActionHandler::register('deletefromlive', 'CMSBatchAction_DeleteFromLive');
	}
开发者ID:redema,项目名称:silverstripe-cms,代码行数:30,代码来源:CMSMain.php

示例8: 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

示例9: init

 public function init()
 {
     // set reading lang
     if (SiteTree::has_extension('Translatable') && !$this->getRequest()->isAjax()) {
         Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree')));
     }
     parent::init();
     Versioned::reading_stage("Stage");
     Requirements::css(CMS_DIR . '/css/screen.css');
     Requirements::customCSS($this->generatePageIconsCss());
     Requirements::combine_files('cmsmain.js', array_merge(array(CMS_DIR . '/javascript/CMSMain.js', CMS_DIR . '/javascript/CMSMain.EditForm.js', CMS_DIR . '/javascript/CMSMain.AddForm.js', CMS_DIR . '/javascript/CMSPageHistoryController.js', CMS_DIR . '/javascript/CMSMain.Tree.js', CMS_DIR . '/javascript/SilverStripeNavigator.js', CMS_DIR . '/javascript/SiteTreeURLSegmentField.js'), Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', true, true)));
     CMSBatchActionHandler::register('publish', 'CMSBatchAction_Publish');
     CMSBatchActionHandler::register('unpublish', 'CMSBatchAction_Unpublish');
     // Check legacy actions
     $legacy = $this->config()->enabled_legacy_actions;
     // Delete from live is unnecessary since we have unpublish which does the same thing
     if (in_array('CMSBatchAction_DeleteFromLive', $legacy)) {
         Deprecation::notice('4.0', 'Delete From Live is deprecated. Use Un-publish instead');
         CMSBatchActionHandler::register('deletefromlive', 'CMSBatchAction_DeleteFromLive');
     }
     // Delete action
     if (in_array('CMSBatchAction_Delete', $legacy)) {
         Deprecation::notice('4.0', 'Delete from Stage is deprecated. Use Archive instead.');
         CMSBatchActionHandler::register('delete', 'CMSBatchAction_Delete');
     } else {
         CMSBatchActionHandler::register('archive', 'CMSBatchAction_Archive');
         CMSBatchActionHandler::register('restore', 'CMSBatchAction_Restore');
     }
 }
开发者ID:phuongle2611,项目名称:silverstripe-cms,代码行数:29,代码来源:CMSMain.php

示例10: Field

    function Field()
    {
        Requirements::javascript(THIRDPARTY_DIR . "/prototype.js");
        Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js");
        Requirements::javascript(THIRDPARTY_DIR . "/prototype_improvements.js");
        Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
        Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js");
        $fieldName = $this->name;
        if ($this->form) {
            $record = $this->form->getRecord();
            if ($record && $record->hasMethod($fieldName)) {
                $items = $record->{$fieldName}();
            }
        }
        if ($items) {
            foreach ($items as $item) {
                $titleArray[] = $item->Title;
                $idArray[] = $item->ID;
            }
            if ($titleArray) {
                $itemList = implode(", ", $titleArray);
                $value = implode(",", $idArray);
            }
        }
        $id = $this->id();
        return <<<HTML
\t\t\t<div class="TreeSelectorField">
\t\t\t\t<input type="hidden" name="{$this->name}" value="{$value}" />
\t\t\t\t<input type="button" class="edit" value="edit" />
\t\t\t\t<span class="items">{$itemList}</span>
\t\t\t</div>\t\t
HTML;
    }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:33,代码来源:TreeSelectorField.php

示例11: Field

 public function Field($properties = array())
 {
     Requirements::javascript(CMS_DIR . '/javascript/SiteTreeURLSegmentField.js');
     Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', false, true);
     Requirements::css(CMS_DIR . "/css/screen.css");
     return parent::Field($properties);
 }
开发者ID:prostart,项目名称:erics-homes,代码行数:7,代码来源:SiteTreeURLSegmentField.php

示例12: ConvertObjectForm

 /**
  * Form used for defining the conversion form
  * @return {Form} Form to be used for configuring the conversion
  */
 public function ConvertObjectForm()
 {
     //Reset the reading stage
     Versioned::reset();
     $fields = new FieldList(CompositeField::create($convertModeField = new OptionsetField('ConvertMode', '', array('ReplacePage' => _t('KapostAdmin.REPLACES_AN_EXISTING_PAGE', '_This replaces an existing page'), 'NewPage' => _t('KapostAdmin.IS_NEW_PAGE', '_This is a new page')), 'NewPage'))->addExtraClass('kapostConvertLeftSide'), CompositeField::create($replacePageField = TreeDropdownField::create('ReplacePageID', _t('KapostAdmin.REPLACE_PAGE', '_Replace this page'), 'SiteTree')->addExtraClass('replace-page-id'), TreeDropdownField::create('ParentPageID', _t('KapostAdmin.USE_AS_PARENT', '_Use this page as the parent for the new page, leave empty for a top level page'), 'SiteTree')->addExtraClass('parent-page-id'))->addExtraClass('kapostConvertRightSide'));
     $actions = new FieldList(FormAction::create('doConvertObject', _t('KapostAdmin.CONTINUE_CONVERT', '_Continue'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'kapost-convert'));
     $validator = new RequiredFields('ConvertMode');
     $form = new Form($this, 'ConvertObjectForm', $fields, $actions, $validator);
     $form->addExtraClass('KapostAdmin center')->setAttribute('data-layout-type', 'border')->setTemplate('KapostAdmin_ConvertForm');
     //Handle pages to see if the page exists
     $convertToClass = $this->getDestinationClass();
     if ($convertToClass !== false && ($convertToClass == 'SiteTree' || is_subclass_of($convertToClass, 'SiteTree'))) {
         $obj = SiteTree::get()->filter('KapostRefID', Convert::raw2sql($this->record->KapostRefID))->first();
         if (!empty($obj) && $obj !== false && $obj->ID > 0) {
             $convertModeField->setValue('ReplacePage');
             $replacePageField->setValue($obj->ID);
             $recordTitle = $this->record->Title;
             if (!empty($recordTitle) && $recordTitle != $obj->Title) {
                 $urlFieldLabel = _t('KapostAdmin.TITLE_CHANGE_DETECT', '_The title differs from the page being replaced, it was "{wastitle}" and will be changed to "{newtitle}". Do you want to update the URL Segment?', array('wastitle' => $obj->Title, 'newtitle' => $recordTitle));
                 $fields->push(CheckboxField::create('UpdateURLSegment', $urlFieldLabel)->addExtraClass('urlsegmentcheck')->setAttribute('data-replace-id', $obj->ID)->setForm($form)->setDescription(_t('KapostAdmin.NEW_URL_SEGMENT', '_The new URL Segment will be or will be close to "{newsegment}"', array('newsegment' => $obj->generateURLSegment($recordTitle)))));
             }
         }
     }
     Requirements::css(KAPOST_DIR . '/css/KapostAdmin.css');
     Requirements::add_i18n_javascript(KAPOST_DIR . '/javascript/lang/');
     Requirements::javascript(KAPOST_DIR . '/javascript/KapostAdmin_convertPopup.js');
     //Allow extensions to adjust the form
     $this->extend('updateConvertObjectForm', $form, $this->record);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-kapost-bridge,代码行数:34,代码来源:KapostGridFieldDetailForm_ItemRequest.php

示例13: getCMSFields

 public function getCMSFields()
 {
     Requirements::add_i18n_javascript(BLOCKS_DIR . '/javascript/lang');
     // this line is a temporary patch until I can work out why this dependency isn't being
     // loaded in some cases...
     if (!$this->blockManager) {
         $this->blockManager = singleton('BlockManager');
     }
     $fields = parent::getCMSFields();
     // ClassNmae - block type/class field
     $classes = $this->blockManager->getBlockClasses();
     $fields->addFieldToTab('Root.Main', DropdownField::create('ClassName', 'Block Type', $classes)->addExtraClass('block-type'), 'Title');
     // BlockArea - display areas field if on page edit controller
     if (Controller::curr()->class == 'CMSPageEditController') {
         $currentPage = Controller::curr()->currentPage();
         $fields->addFieldToTab('Root.Main', DropdownField::create('ManyMany[BlockArea]', 'BlockArea', $this->blockManager->getAreasForPageType($currentPage->ClassName))->setHasEmptyDefault(true)->setRightTitle($currentPage->areasPreviewButton()), 'ClassName');
     }
     $fields->removeFieldFromTab('Root', 'BlockSets');
     $fields->removeFieldFromTab('Root', 'Pages');
     // legacy fields, will be removed in later release
     $fields->removeByName('Weight');
     $fields->removeByName('Area');
     $fields->removeByName('Published');
     if ($this->blockManager->getUseExtraCSSClasses()) {
         $fields->addFieldToTab('Root.Main', $fields->dataFieldByName('ExtraCSSClasses'), 'Title');
     } else {
         $fields->removeByName('ExtraCSSClasses');
     }
     // Viewer groups
     $fields->removeFieldFromTab('Root', 'ViewerGroups');
     $groupsMap = Group::get()->map('ID', 'Breadcrumbs')->toArray();
     asort($groupsMap);
     $viewersOptionsField = new OptionsetField("CanViewType", _t('SiteTree.ACCESSHEADER', "Who can view this page?"));
     $viewerGroupsField = ListboxField::create("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('SiteTree.GroupPlaceholder', 'Click to select group'));
     $viewersOptionsSource = array();
     $viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone");
     $viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
     $viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)");
     $viewersOptionsField->setSource($viewersOptionsSource)->setValue("Anyone");
     $fields->addFieldsToTab('Root.ViewerGroups', array($viewersOptionsField, $viewerGroupsField));
     // Disabled for now, until we can list ALL pages this block is applied to (inc via sets)
     // As otherwise it could be misleading
     // Show a GridField (list only) with pages which this block is used on
     // $fields->removeFieldFromTab('Root.Pages', 'Pages');
     // $fields->addFieldsToTab('Root.Pages',
     // 		new GridField(
     // 				'Pages',
     // 				'Used on pages',
     // 				$this->Pages(),
     // 				$gconf = GridFieldConfig_Base::create()));
     // enhance gridfield with edit links to pages if GFEditSiteTreeItemButtons is available
     // a GFRecordEditor (default) combined with BetterButtons already gives the possibility to
     // edit versioned records (Pages), but STbutton loads them in their own interface instead
     // of GFdetailform
     // if(class_exists('GridFieldEditSiteTreeItemButton')){
     // 	$gconf->addComponent(new GridFieldEditSiteTreeItemButton());
     // }
     return $fields;
 }
开发者ID:mhssmnn,项目名称:silverstripe-blocks,代码行数:59,代码来源:Block.php

示例14: init

 public function init()
 {
     parent::init();
     Requirements::css(SS_NR_BASE . '/css/NewRelicPerformanceReport.css');
     Requirements::add_i18n_javascript(SS_NR_BASE . '/javascript/lang');
     Requirements::javascript(SS_NR_BASE . '/javascript/NewRelicPerformanceReport.js');
     Requirements::javascript(SS_NR_BASE . '/thirdparty/nnnick/chart-js/chart.min.js');
 }
开发者ID:webbuilders-group,项目名称:silverstripe-new-relic,代码行数:8,代码来源:NewRelicPerformanceReport.php

示例15: Field

 /**
  * Get HTML for the field to display
  *
  * @param array $properties Properties array
  * @return string
  */
 public function Field($properties = array())
 {
     $module_dir = basename(dirname(dirname(__DIR__)));
     Requirements::javascript($module_dir . '/javascript/MovieTitleField.js');
     Requirements::add_i18n_javascript($module_dir . '/javascript/lang');
     $list = new ArrayList($this->composite_fields);
     return $list->renderWith('MovieTitleField');
 }
开发者ID:hughdavenport,项目名称:silverstripe-movieinformation,代码行数:14,代码来源:MovieTitleField.php


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