/** * {@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; }
/** * 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(); }
/** * {@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(); }
/** * 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; }
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; }
/** * {@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; }
/** * 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(); }
/** * 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(); }