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


PHP EntityInterface::getToState方法代码示例

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


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

示例1: buildRow

 /**
  * {@inheritdoc}
  */
 public function buildRow(EntityInterface $entity)
 {
     $row['to']['#markup'] = $this->stateStorage->load($entity->getToState())->label();
     $row['label'] = $entity->label();
     $row['roles']['#markup'] = implode(', ', user_role_names(FALSE, 'use ' . $entity->id() . ' transition'));
     return $row + parent::buildRow($entity);
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:ModerationStateTransitionListBuilder.php

示例2: buildRow

 /**
  * {@inheritdoc}
  */
 public function buildRow(EntityInterface $entity)
 {
     /** @var ModerationStateTransitionInterface $entity */
     $row['label'] = $entity->label();
     $row['id']['#markup'] = $entity->id();
     $row['from']['#markup'] = $this->stateStorage->load($entity->getFromState())->label();
     $row['to']['#markup'] = $this->stateStorage->load($entity->getToState())->label();
     return $row + parent::buildRow($entity);
 }
开发者ID:dropdog,项目名称:play,代码行数:12,代码来源:ModerationStateTransitionListBuilder.php

示例3: buildRow

 /**
  * {@inheritdoc}
  *
  * @todo D8-port: add D7-theming to TransitionListBuilder.
  */
 public function buildRow(EntityInterface $transition)
 {
     // Show the history table.
     $current_themed = FALSE;
     /* @var $transition WorkflowTransitionInterface */
     $entity = $transition->getTargetEntity();
     $field_name = $transition->getFieldName();
     $current_sid = workflow_node_current_state($entity, $field_name);
     $to_state = $transition->getToState();
     if (!$to_state) {
         // This is an invalid/deleted state.
         $to_label = WORKFLOW_MARK_STATE_IS_DELETED;
         // Add a footer to explain the addition.
         $this->footer_needed = TRUE;
     } else {
         $label = Html::escape($this->t($to_state->label()));
         if ($transition->getToSid() == $current_sid && $to_state->isActive() && !$current_themed) {
             $to_label = $label;
             if (!$current_themed) {
                 // Make a note that we have themed the current state; other times in the history
                 // of this entity where the entity was in this state do not need to be specially themed.
                 $current_themed = TRUE;
             }
         } elseif (!$to_state->isActive()) {
             $to_label = $label . WORKFLOW_MARK_STATE_IS_DELETED;
             // Add a footer to explain the addition.
             $this->footer_needed = TRUE;
         } else {
             // Regular state.
             $to_label = $label;
         }
     }
     unset($to_state);
     // Not needed anymore.
     $from_state = $transition->getFromState();
     if (!$from_state) {
         // This is an invalid/deleted state.
         $from_label = WORKFLOW_MARK_STATE_IS_DELETED;
         // Add a footer to explain the addition.
         $this->footer_needed = TRUE;
     } else {
         $label = Html::escape($this->t($from_state->label()));
         if (!$from_state->isActive()) {
             $from_label = $label . WORKFLOW_MARK_STATE_IS_DELETED;
             // Add a footer to explain the addition.
             $this->footer_needed = TRUE;
         } else {
             // Regular state.
             $from_label = $label;
         }
     }
     unset($from_state);
     // Not needed anymore.
     $owner = $transition->getOwner();
     $field_name = $transition->getFieldName();
     $field_label = $transition->getFieldName();
     $variables = array('transition' => $transition, 'extra' => '', 'from_label' => $from_label, 'to_label' => $to_label, 'user' => $owner);
     // Allow other modules to modify the row.
     \Drupal::moduleHandler()->alter('workflow_history', $variables);
     //     'class' => array('workflow_history_row'), // TODO D8-port
     $row['timestamp']['data'] = $transition->getTimestampFormatted();
     // 'class' => array('timestamp')
     // html_entity_decode() transforms chars like '&' correctly.
     if ($this->showColumnFieldname($entity)) {
         $row['field_name']['data'] = html_entity_decode($field_label);
     }
     $row['from_state']['data'] = html_entity_decode($from_label);
     // 'class' => array('previous-state-name'))
     $row['to_state']['data'] = html_entity_decode($to_label);
     // 'class' => array('state-name'))
     $row['user_name']['data'] = $owner->getUsername();
     // 'class' => array('user-name')
     $row['comment']['data'] = html_entity_decode($transition->getComment());
     // 'class' => array('log-comment')
     //    $row['comment'] = array(
     //      '#type' => 'textarea',
     //      '#default_value' => $transition->getComment(),
     //    );
     // Column 'Operations' is now added by core.
     // D7: $row['operations']['data'] = $this->buildOperations($entity);
     $row += parent::buildRow($transition);
     return $row;
 }
开发者ID:sedurzu,项目名称:ildeposito8,代码行数:88,代码来源:WorkflowTransitionListBuilder.php


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