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


PHP NodeType::label方法代碼示例

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


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

示例1: submitForm

  /**
   * @inheritdoc
   *
   * Final submit handler- gather all data together and create new content type.
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->prefix = $this->randomString(4);
    $this->properties = array();
    foreach ($form_state->getValue('fields') as $key => $property) {
      if ($property['enable'] == 1) {
        $this->properties[$key] = $property;
      }
    }

    $page_one_values = $form_state->get(['page_values', 1]);
    $rdf_type = $page_one_values['rdf-type'];

    $this->createNodeType($rdf_type);

    $this->rdfMapping = rdf_get_mapping('node', $this->entity->id());
    $this->rdfMapping->setBundleMapping(array('types' => array($rdf_type)));

    $this->createField();
    $this->rdfMapping->save();

    drupal_set_message($this->t('Content Type %label created', array('%label' => $this->entity->label())));
    /*@TODO Revert all saved content type and fields in case of error*/
    $form_state->setRedirectUrl(new Url('entity.node.field_ui_fields', array(
      'node_type' => $this->entity->id(),
    )));
  }
開發者ID:eloiv,項目名稱:botafoc.cat,代碼行數:31,代碼來源:ContentBuilderForm.php

示例2: buildPermissions

 /**
  * Builds a standard list of node permissions for a given type.
  *
  * @param \Drupal\node\Entity\NodeType $type
  *   The machine name of the node type.
  *
  * @return array
  *   An array of permission names and descriptions.
  */
 protected function buildPermissions(NodeType $type)
 {
     $type_id = $type->id();
     $type_params = array('%type_name' => $type->label());
     return array("create {$type_id} content" => array('title' => $this->t('%type_name: Create new content', $type_params)), "edit own {$type_id} content" => array('title' => $this->t('%type_name: Edit own content', $type_params)), "edit any {$type_id} content" => array('title' => $this->t('%type_name: Edit any content', $type_params)), "delete own {$type_id} content" => array('title' => $this->t('%type_name: Delete own content', $type_params)), "delete any {$type_id} content" => array('title' => $this->t('%type_name: Delete any content', $type_params)), "view {$type_id} revisions" => array('title' => $this->t('%type_name: View revisions', $type_params)), "revert {$type_id} revisions" => array('title' => $this->t('%type_name: Revert revisions', $type_params), 'description' => t('Role requires permission <em>view revisions</em> and <em>edit rights</em> for nodes in question, or <em>administer nodes</em>.')), "delete {$type_id} revisions" => array('title' => $this->t('%type_name: Delete revisions', $type_params), 'description' => $this->t('Role requires permission to <em>view revisions</em> and <em>delete rights</em> for nodes in question, or <em>administer nodes</em>.')));
 }
開發者ID:nsp15,項目名稱:Drupal8,代碼行數:15,代碼來源:NodePermissions.php

示例3: buildPermissions

 /**
  * Returns a list of view unpublished permissions for a given node type.
  *
  * @param \Drupal\node\Entity\NodeType $type
  *   The node type.
  *
  * @return array
  *   An associative array of permission names and descriptions.
  */
 protected function buildPermissions(NodeType $type)
 {
     $type_id = $type->id();
     $type_params = array('%type_name' => $type->label());
     return array("view any unpublished {$type_id} content" => array('title' => $this->t('%type_name: View any unpublished content', $type_params)));
 }
開發者ID:dakala,項目名稱:view_unpublished,代碼行數:15,代碼來源:ViewUnpublishedPermissions.php


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