當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ConfigEntityBase::save方法代碼示例

本文整理匯總了PHP中Drupal\Core\Config\Entity\ConfigEntityBase::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConfigEntityBase::save方法的具體用法?PHP ConfigEntityBase::save怎麽用?PHP ConfigEntityBase::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Config\Entity\ConfigEntityBase的用法示例。


在下文中一共展示了ConfigEntityBase::save方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 /**
  * {@inheritdoc}
  */
 public function save()
 {
     // Make sure we don't have any save exceptions before building menu
     // definitions.
     $return = parent::save();
     foreach ($this->getLinks([], TRUE) as $link_key => $link_def) {
         $this->getMenuLinkManager()->addDefinition($link_key, $link_def);
     }
     return $return;
 }
開發者ID:nerdstein,項目名稱:taxonomy_menu,代碼行數:13,代碼來源:TaxonomyMenu.php

示例2: save

 /**
  * Overrides Drupal\Core\Entity\Entity::save().
  */
 public function save()
 {
     // Check if everything is valid.
     if (!$this->isValid()) {
         throw new InvalidBreakpointException('Invalid data detected.');
     }
     parent::save();
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:11,代碼來源:BreakpointGroup.php

示例3: save

 /**
  * {@inheritdoc}
  */
 public function save($create_creation_state = TRUE)
 {
     // Create the machine_name for new states.
     // N.B.: Keep machine_name in WorkflowState and ~ListBuilder aligned.
     $sid = $this->id();
     $wid = $this->wid;
     if (empty($sid) || $sid == WORKFLOW_CREATION_STATE_NAME) {
         if ($label = $this->label()) {
             // Format the machine_name. @todo Use a proper machine_name regex.
             $sid = str_replace(' ', '_', strtolower($label));
         } else {
             workflow_debug(__FILE__, __FUNCTION__, __LINE__);
             // @todo D8-port: still test this snippet.
             $sid = 'state_' . $this->id();
         }
         $this->set('id', implode('_', [$wid, $sid]));
     }
     return parent::save();
 }
開發者ID:sedurzu,項目名稱:ildeposito8,代碼行數:22,代碼來源:WorkflowState.php

示例4: save

 /**
  * Given information, update or insert a new workflow.
  *
  * This also handles importing, rebuilding, reverting from Features,
  * as defined in workflow.features.inc.
  * TODO D8: clean up this function, since we are config entity now.
  * todo D7: reverting does not refresh States and transitions, since no
  * machine_name was present. As of 7.x-2.3, the machine_name exists in
  * Workflow and WorkflowConfigTransition, so rebuilding is possible.
  *
  * When changing this function, test with the following situations:
  * - maintain Workflow in Admin UI;
  * - clone Workflow in Admin UI;
  * - create/revert/rebuild Workflow with Features; @see workflow.features.inc
  * - save Workflow programmatic;
  *
  * @inheritdoc
  */
 public function save()
 {
     $status = parent::save();
     // Are we saving a new Workflow?
     // Make sure a Creation state exists.
     if ($status == SAVED_NEW) {
         $state = $this->getCreationState();
     }
     return $status;
 }
開發者ID:sedurzu,項目名稱:ildeposito8,代碼行數:28,代碼來源:Workflow.php

示例5: save

 public function save()
 {
     $workflow = $this->getWorkflow();
     // To avoid double posting, check if this (new) transition already exist.
     if (empty($this->id())) {
         if ($workflow) {
             $config_transitions = $workflow->getTransitionsByStateId($this->from_sid, $this->to_sid);
             $config_transition = reset($config_transitions);
             if ($config_transition) {
                 $this->set('id', $config_transition->id());
             }
         }
     }
     // Create the machine_name. This can be used to rebuild/revert the Feature in a target system.
     if (empty($this->id())) {
         $wid = $workflow->id();
         $this->set('id', implode('', [$wid, substr($this->from_sid, strlen($wid)), substr($this->to_sid, strlen($wid))]));
     }
     $status = parent::save();
     if ($status) {
         // Save in current workflow for the remainder of this page request.
         // Keep in sync with Workflow::getTransitions() !
         if ($workflow) {
             $workflow->transitions[$this->id()] = $this;
             // $workflow->sortTransitions();
         }
     }
     return $status;
 }
開發者ID:sedurzu,項目名稱:ildeposito8,代碼行數:29,代碼來源:WorkflowConfigTransition.php

示例6: save

 /**
  * {@inheritdoc}
  */
 public function save()
 {
     $return = parent::save();
     // Rebuild route information when browsers that register routes
     // are created/updated.
     \Drupal::service('router.builder')->rebuild();
     return $return;
 }
開發者ID:DrupalTV,項目名稱:DrupalTV,代碼行數:11,代碼來源:EntityBrowser.php

示例7: save

 /**
  * Overrides Drupal\config\ConfigEntityBase::save().
  */
 public function save()
 {
     // Check if everything is valid.
     if (!$this->isValid()) {
         throw new InvalidBreakpointException('Invalid data detected.');
     }
     // Set the label if none is set.
     if (empty($this->label)) {
         $this->label = $this->name;
     }
     // Remove unused multipliers.
     $this->multipliers = array_filter($this->multipliers);
     // Always add '1x' multiplier, use array_key_exists since the value might
     // be NULL.
     if (!array_key_exists('1x', $this->multipliers)) {
         $this->multipliers = array('1x' => '1x') + $this->multipliers;
     }
     return parent::save();
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:22,代碼來源:Breakpoint.php

示例8: save

 /**
  * Overrides Drupal\Core\Entity::save().
  */
 public function save()
 {
     // Only save the keys, but return the full objects.
     $breakpoint_group = $this->getBreakpointGroup();
     if ($breakpoint_group && is_object($breakpoint_group)) {
         $this->setBreakpointGroup($breakpoint_group->id());
     }
     // Split the breakpoint ids into their different parts, as dots as
     // identifiers are not possible.
     $loaded_mappings = $this->mappings;
     $this->mappings = array();
     foreach ($loaded_mappings as $breakpoint_id => $mapping) {
         list($source_type, $source, $name) = explode('.', $breakpoint_id);
         $this->mappings[$source_type][$source][$name] = $mapping;
     }
     parent::save();
     $this->loadBreakpointGroup();
     $this->loadAllMappings();
 }
開發者ID:alnutile,項目名稱:drunatra,代碼行數:22,代碼來源:ResponsiveImageMapping.php


注:本文中的Drupal\Core\Config\Entity\ConfigEntityBase::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。