コード例 #1
0
 /**
  * standard SS method
  * @var Array
  **/
 public function updateSettingsFields(FieldList $fields)
 {
     $fields->addFieldToTab("Root.Facebook", new HeaderField(_t("MetaTagsSTE.FB_HOW_THIS_PAGE_IS_SHARED", "How is this page shared on Facebook?")));
     $fields->addFieldToTab("Root.Facebook", $fieldTitle = new ReadonlyField("fb_title", _t("MetaTagsSTE.FB_TITLE", "Title"), $this->owner->Title));
     $fields->addFieldToTab("Root.Facebook", $fieldType = new ReadonlyField("fb_type", _t("MetaTagsSTE.FB_TITLE", "Type"), "website"));
     $fields->addFieldToTab("Root.Facebook", $fieldSiteName = new ReadonlyField("fb_type", _t("MetaTagsSTE.FB_SITE_NAME", "Site Name"), SiteConfig::current_site_config()->Title));
     $fields->addFieldToTab("Root.Facebook", $fieldDescription = new ReadonlyField("fb_description", _t("MetaTagsSTE.FB_DESCRIPTION", "Description (from MetaDescription)"), $this->owner->MetaDescription));
     $fields->addFieldToTab("Root.Facebook", $shareOnFacebookImageField = new UploadField("ShareOnFacebookImage", _t("MetaTagsSTE.FB_IMAGE", "Image")));
     $shareOnFacebookImageField->setFolderName("OpenGraphShareImages");
     $shareOnFacebookImageField->setRightTitle("Use images that are at least 1200 x 630 pixels for the best display on high resolution devices. At the minimum, you should use images that are 600 x 315 pixels to display link page posts with larger images.");
     $fields->addFieldToTab("Root.Facebook", $shareOnFacebookImageField = new LiteralField("fb_try_it_out", '<h3><a href="https://www.facebook.com/sharer/sharer.php?u=' . urlencode($this->owner->AbsoluteLink()) . '">' . _t("MetaTagsSTE.FB_TRY_IT_OUT", "Share on Facebook Now") . '</a></h3>', $this->owner->ShareOnFacebookImage()));
     //right titles
     $fieldTitle->setRightTitle(_t("MetaTagsSTE.FB_TITLE_RIGHT", "Uses the Page Title"));
     $fieldType->setRightTitle(_t("MetaTagsSTE.FB_TYPE_RIGHT", "Can not be changed"));
     $fieldSiteName->setRightTitle(_t("MetaTagsSTE.FB_SITE_NAME_RIGHT", "Can be set in the site settings"));
     $fieldDescription->setRightTitle(_t("MetaTagsSTE.FB_DESCRIPTION", "Description is set in the Metadata section of each page."));
     $shareOnFacebookImageField->setRightTitle(_t("MetaTagsSTE.FB_HOW_TO_CHOOSE_IMAGE", "If no image is set then the Facebook user can choose an image from the page - with options retrieved by Facebook."));
 }
コード例 #2
0
 /**
  */
 public function getCMSFields()
 {
     $cmsUsers = Member::mapInCMSGroups();
     $fields = new FieldList(new TabSet('Root'));
     $fields->addFieldToTab('Root.Main', new TextField('Title', _t('WorkflowDefinition.TITLE', 'Title')));
     $fields->addFieldToTab('Root.Main', new TextareaField('Description', _t('WorkflowDefinition.DESCRIPTION', 'Description')));
     if ($this->ID) {
         $fields->addFieldToTab('Root.Main', new CheckboxSetField('Users', _t('WorkflowDefinition.USERS', 'Users'), $cmsUsers));
         $fields->addFieldToTab('Root.Main', new TreeMultiselectField('Groups', _t('WorkflowDefinition.GROUPS', 'Groups'), 'Group'));
     }
     if (class_exists('AbstractQueuedJob')) {
         $before = _t('WorkflowDefinition.SENDREMINDERDAYSBEFORE', 'Send reminder email after ');
         $after = _t('WorkflowDefinition.SENDREMINDERDAYSAFTER', ' days without action.');
         $fields->addFieldToTab('Root.Main', new FieldGroup(_t('WorkflowDefinition.REMINDEREMAIL', 'Reminder Email'), new LabelField('ReminderEmailBefore', $before), new NumericField('RemindDays', ''), new LabelField('ReminderEmailAfter', $after)));
     }
     if ($this->ID) {
         if ($this->Template) {
             $template = $this->workflowService->getNamedTemplate($this->Template);
             $fields->addFieldToTab('Root.Main', new ReadonlyField('Template', _t('WorkflowDefinition.TEMPLATE_NAME', 'Source Template'), $this->Template));
             $fields->addFieldToTab('Root.Main', new ReadonlyField('TemplateDesc', _t('WorkflowDefinition.TEMPLATE_INFO', 'Template Info'), $template ? $template->getDescription() : ''));
             $fields->addFieldToTab('Root.Main', $tv = new ReadonlyField('TemplateVersion', _t('WorkflowDefinition:TEMPLATE_VERSION', 'Template Version')));
             $tv->setRightTitle(sprintf(_t('WorkflowDefinition.LATEST_VERSION', 'Latest version is %s'), $template->getVersion()));
         }
         $fields->addFieldToTab('Root.Main', new WorkflowField('Workflow', _t('WorkflowDefinition.WORKFLOW', 'Workflow'), $this));
     } else {
         // add in the 'template' info
         $templates = $this->workflowService->getTemplates();
         if (is_array($templates)) {
             $items = array('' => '');
             foreach ($templates as $template) {
                 $items[$template->getName()] = $template->getName();
             }
             $templates = array_combine(array_keys($templates), array_keys($templates));
             $fields->addFieldToTab('Root.Main', $dd = new DropdownField('Template', _t('WorkflowDefinition.CHOOSE_TEMPLATE', 'Choose template (optional)'), $items));
             $dd->setRightTitle('If set, this workflow definition will be automatically updated if the template is changed');
         }
         $message = _t('WorkflowDefinition.ADDAFTERSAVING', 'You can add workflow steps after you save for the first time.');
         $fields->addFieldToTab('Root.Main', new LiteralField('AddAfterSaving', "<p class='message notice'>{$message}</p>"));
     }
     if ($this->ID && Permission::check('VIEW_ACTIVE_WORKFLOWS')) {
         $active = $this->Instances()->filter(array('WorkflowStatus' => array('Active', 'Paused')));
         $active = new GridField('Active', 'Active Workflow Instances', $active, new GridFieldConfig_RecordEditor());
         $active->getConfig()->removeComponentsByType('GridFieldAddNewButton');
         $active->getConfig()->removeComponentsByType('GridFieldDeleteAction');
         if (!Permission::check('REASSIGN_ACTIVE_WORKFLOWS')) {
             $active->getConfig()->removeComponentsByType('GridFieldEditButton');
             $active->getConfig()->addComponent(new GridFieldViewButton());
             $active->getConfig()->addComponent(new GridFieldDetailForm());
         }
         $completed = $this->Instances()->filter(array('WorkflowStatus' => array('Complete', 'Cancelled')));
         $config = new GridFieldConfig_Base();
         $config->addComponent(new GridFieldEditButton());
         $config->addComponent(new GridFieldDetailForm());
         $completed = new GridField('Completed', 'Completed Workflow Instances', $completed, $config);
         $fields->addFieldToTab('Root.Active', $active);
         $fields->addFieldToTab('Root.Completed', $completed);
     }
     return $fields;
 }