Example #1
0
 /**
  * {@inheritdoc}
  */
 public static function preCreate(EntityStorageInterface $storage, array &$values)
 {
     parent::preCreate($storage, $values);
     if (empty($values['type'])) {
         $values['type'] = $storage->getEntityTypeId();
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public static function preCreate(EntityStorageInterface $storage_controller, array &$values)
 {
     parent::preCreate($storage_controller, $values);
     $values += array('user_id' => \Drupal::currentUser()->id());
     if (isset($values['issue_type'])) {
         $values['issue_type'] = \Drupal::service('checkstyle.issue.nodemapper')->getCheckstyleTypeId($values['issue_type']);
     }
     return FALSE;
 }
 /**
  * {@inheritdoc}
  */
 public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
   parent::preCreate($storage_controller, $values);
   $values += array(
     'user_id' => \Drupal::currentUser()->id(),
   );
 }
 /**
  * {@inheritdoc}
  */
 public static function preCreate(EntityStorageInterface $storage, array &$values)
 {
     parent::preCreate($storage, $values);
     if (!isset($values['shortcut_set'])) {
         $values['shortcut_set'] = 'default';
     }
 }
Example #5
0
 /**
  * {@inheritdoc}
  *
  * @todo Remove once https://drupal.org/node/1979260 is done.
  */
 public static function preCreate(EntityStorageInterface $storage, array &$values)
 {
     parent::preCreate($storage, $values);
     $account = \Drupal::currentUser();
     // Set user id of contact owner.
     $values += array('uid' => $account->id());
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 static function preCreate(EntityStorageInterface $storage, array &$values)
 {
     parent::preCreate($storage, $values);
     // Users always have the authenticated user role.
     $values['roles'][] = DRUPAL_AUTHENTICATED_RID;
 }
Example #7
0
 /**
  * {@inheritdoc}
  */
 public static function preCreate(EntityStorageInterface $storage, array &$values)
 {
     parent::preCreate($storage, $values);
     // Set default values.
     $store_config = \Drupal::config('uc_store.settings');
     $values += ['order_status' => uc_order_state_default('in_checkout'), 'currency' => $store_config->get('currency.code'), 'billing_country' => $store_config->get('address.country'), 'delivery_country' => $store_config->get('address.country'), 'created' => REQUEST_TIME];
     // Take the primary email address from the user, if necessary.
     if (empty($values['primary_email']) && !empty($values['uid'])) {
         if ($account = User::load($values['uid'])) {
             $values['primary_email'] = $account->getEmail();
         }
     }
 }