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


PHP node_type_get_types函数代码示例

本文整理汇总了PHP中node_type_get_types函数的典型用法代码示例。如果您正苦于以下问题:PHP node_type_get_types函数的具体用法?PHP node_type_get_types怎么用?PHP node_type_get_types使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: hook_admin_menu_map

/**
 * Provide expansion arguments for dynamic menu items, i.e. menu paths
 * containing one or more %placeholders.
 *
 * The map items must be keyed by the dynamic path to expand. Each map item may
 * have the following properties:
 *
 * - parent: The parent menu path to link the expanded items to.
 * - arguments: An array of argument sets that will be used in the
 *   expansion. Each set consists of an array of one or more placeholders with
 *   an array of possible expansions as value. Upon expansion, each argument
 *   is combined with every other argument from the set (ie., the cartesian
 *   product of all arguments is created). The expansion values may be empty,
 *   that is, you don't need to insert logic to skip map items for which no
 *   values exist, since admin menu will take care of that.
 * - hide: (optional) Used to hide another menu item, usually a superfluous
 *   "List" item.
 *
 * @see admin_menu.map.inc
 */
function hook_admin_menu_map()
{
    // Expand content types in Structure >> Content types.
    // The key denotes the dynamic path to expand to multiple menu items.
    $map['admin/structure/types/manage/%node_type'] = array('parent' => 'admin/structure/types', 'hide' => 'admin/structure/types/list', 'arguments' => array(array('%node_type' => array_keys(node_type_get_types()))));
    return $map;
}
开发者ID:nagwani,项目名称:debugging_example,代码行数:27,代码来源:admin_menu.api.php

示例2: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $results = $_POST;
     $form['method'] = array('#type' => 'hidden', '#value' => $results['method']);
     if (!isset($results['reset'])) {
         $results['reset'] = 0;
     }
     $form['all'] = array('#type' => 'hidden', '#value' => $results['all']);
     if (isset($results['all'])) {
         // Only carry reset value through if delete all nodes is set
         $form['reset'] = array('#type' => 'hidden', '#value' => $results['reset']);
         $form['all_warning'] = array('#markup' => '<p>' . $this->t('All content in all content types will be deleted. Be sure to have a backup of any important data!') . '</p>');
         if (!empty($results['reset'])) {
             if ($results['all']) {
                 $form['all_reset'] = array('#markup' => '<p>' . $this->t('Node, revision and comment counts will be reset.') . '</p>');
             }
         }
     } elseif (isset($results['types'])) {
         if (is_array($results['types'])) {
             foreach ($results['types'] as $key_type => $type) {
                 /**
                  * @TODO, if we use the form array the value doesn't exist in the submit
                  */
                 $_SESSION['nodes_type'][$key_type] = $type;
                 $info = node_type_get_types('type', $type);
                 $info = $info[$type];
                 $form[$type . '_warning'] = array('#markup' => '<p>' . $this->t('All content in the %type content type will be deleted. Be sure to have a backup of any important data!', array('%type' => $info->get('name'))) . '</p>');
             }
         }
         if ($results['reset']) {
             $form['all_reset'] = array('#markup' => '<p>' . $this->t('Sorry, we can\'t reset the counters because you are not deleting all nodes.') . '</p>');
         }
     }
     return parent::buildForm($form, $form_state);
 }
开发者ID:blakefrederick,项目名称:sas-backend,代码行数:38,代码来源:DeleteContentConfirmForm.php

示例3: settingsForm

 /**
  * Generate a settings form for this handler.
  */
 public function settingsForm($field, $instance)
 {
     #    echo '<pre>';
     #    print_r($instance);
     #    echo '</pre>';
     #    die;
     $options = array();
     if (!empty($field['settings']['handler_settings']['target_bundles'])) {
         $target_bundles = $field['settings']['handler_settings']['target_bundles'];
     } else {
         // By default, entity reference assumes that all bundles are enabled.
         $target_bundles = array_keys(node_type_get_types());
     }
     foreach ($target_bundles as $content_type) {
         $options[$content_type] = t(node_type_get_name($content_type));
     }
     $default_options = array();
     if (isset($instance['settings']['behaviors']['node_links'])) {
         foreach ($instance['settings']['behaviors']['node_links']['content_types'] as $content_type) {
             if ($content_type) {
                 $default_options[] = $content_type;
             }
         }
     }
     $form['content_types'] = array('#type' => 'checkboxes', '#title' => t('Content Types'), '#options' => $options, '#default_value' => $default_options, '#description' => t('Select the content types that will have create links for this type.'));
     return $form;
 }
开发者ID:acquiau-2015,项目名称:acquiau-drizzle,代码行数:30,代码来源:PrepopulateCreateNodeLinksInstanceBehavior.class.php

示例4: prepare

 /**
  * Override Migration::prepare().
  *
  * Set the term parent for heirarchical terms
  *
  * @param $term
  * @param $row
  */
 public function prepare($term, $row)
 {
     // Handle og_vocab
     $vocab_name = $this->bundle;
     if (!($vocabulary = taxonomy_vocabulary_machine_name_load($vocab_name))) {
         // Create a new vocabulary
         $vocabulary = (object) array('name' => 'Meter categories for ' . $row->account_id, 'description' => 'Meter categories for ' . $row->account_id, 'machine_name' => $vocab_name);
         taxonomy_vocabulary_save($vocabulary);
     }
     // Create an OG-vocab and relate new vocabulary with OG.
     $account_id = $term->account_id['destid1'];
     $settings = array('cardinality' => 1, 'required' => TRUE);
     // Loop for all meter content-types and create og-vocabulary.
     $node_types = node_type_get_types();
     foreach ($node_types as $content_type) {
         if (strpos($content_type->type, '_meter') === FALSE) {
             // Not a meter type, skip.
             continue;
         }
         $og_vocab = og_vocab_create_og_vocab($vocabulary->vid, 'node', $content_type->type, OG_VOCAB_FIELD, $settings);
         $og_vocab->save();
     }
     og_vocab_relation_save($vocabulary->vid, 'node', $account_id);
     // Save vocabulary id.
     $term->vid = $vocabulary->vid;
     // Handle parent.
     $term->name = ucwords(trim($term->name));
     $parent = ucwords(trim($row->parent));
     $parent_term = taxonomy_get_term_by_name($parent, $vocab_name);
     $parent_term = reset($parent_term);
     if ($parent_term) {
         $term->parent = $parent_term->tid;
     }
 }
开发者ID:Gizra,项目名称:negawatt-server,代码行数:42,代码来源:NegawattMeterCategoryTermsBase.php

示例5: dxray_get_node_type

/**
 *  Получаем список NODE_TYPE
 * modules/node/node.module
 * @link https://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_info/7 description param
 * @link https://www.drupal.org/node/1027630 info
 */
function dxray_get_node_type()
{
    $GML = new GraphML();
    $optN1 = $GML->setOptionsNode()->Fill_setColor('#ccffff')->Label_setFontSize('22')->getOptions();
    $aNtypes = node_type_get_types();
    foreach ($aNtypes as $oType) {
        // 1. Сначала создаем узел NODE_TYPE
        $data['attributes'] = array('Base: ' . $oType->base, 'Type: ' . $oType->type, 'Help: ' . PHP_EOL . $oType->help . PHP_EOL, 'Custom: ' . $oType->custom, 'Modified: ' . $oType->modified, 'Locked: ' . $oType->locked, 'Disabled: ' . $oType->disabled, 'Is new: ' . $oType->is_new, 'Has title: ' . $oType->has_title, 'Title label: ' . $oType->title_label, 'Module: ' . $oType->module);
        $options['NodeFill']['color'] = '#ccffff';
        $ID_bundle = $GML->addNode($oType->name, 'UMLClassNode', $optN1, $data);
        dxray_debug_stdout('Добавили bundle номер: ' . $ID_bundle);
        // 2. Получаем поля данного контента и строем зависимости
        $fields = field_info_instances('node', $oType->type);
        foreach ($fields as $field) {
            $finfo = field_info_field($field['field_name']);
            $data['attributes'] = array('Label: ' . $field['label'], 'Required: ' . $field['required'], 'Module: ' . $finfo['module'], 'Locked: ' . $finfo['locked'], 'Cardinality: ' . $finfo['cardinality'], 'Description: ' . $field['description']);
            $dataHTML['attributes'] = array('<html>', 'Label: ' . $field['label'] . '<br>', 'Required: ' . $field['required'] . '<br>', '<b>Module:</b> ' . $finfo['module'] . '<br>', 'Locked: ' . $finfo['locked'] . '<br>', 'Cardinality: ' . $finfo['cardinality'] . '<br>', 'Description: ' . $field['description'] . '<br>', '</html>');
            $ID_field = $GML->addNode($field['field_name'], 'UMLClassNode', null, $dataHTML);
            dxray_debug_stdout('Добавили field номер: ' . $ID_field);
            dxray_debug_stdout("{EDGE} SRC: {$ID_bundle} TARGET: {$ID_field} " . $ID_field);
            $GML->addEdge($ID_bundle, $ID_field);
        }
    }
    $file = DXRAY_OUTPATH . '/NodeType-' . date('d-m-Y_H-i-s') . '.graphml';
    $GML->createFullGraphML($file);
    $dbg = 0;
}
开发者ID:JKeySZR,项目名称:GraphML,代码行数:33,代码来源:drupal.php

示例6: describe

 /**
  * {@inheritdoc}
  */
 function describe($api)
 {
     // We will have a separate rule per node type on Admin > Structure > Crumbs.
     foreach (node_type_get_types() as $type_name => $type) {
         $api->addRule($type_name, $type->name);
     }
 }
开发者ID:marecar,项目名称:acadcms,代码行数:10,代码来源:ListOfNews.php

示例7: hook_field_extra_fields_alter

/**
 * Alter "pseudo-field" components on fieldable entities.
 *
 * @param $info
 *   The associative array of 'pseudo-field' components.
 *
 * @see hook_field_extra_fields()
 */
function hook_field_extra_fields_alter(&$info) {
  // Force node title to always be at the top of the list by default.
  foreach (node_type_get_types() as $bundle) {
    if (isset($info['node'][$bundle]['title'])) {
      $info['node'][$bundle]['title']['weight'] = -20;
    }
  }
}
开发者ID:richielokay,项目名称:drupal7,代码行数:16,代码来源:field.api.php

示例8: getContentTypes

 /**
  * Add the types to the form. If there are no eligible types to delete,
  * we don't need to render the form.
  */
 protected function getContentTypes()
 {
     foreach (node_type_get_types() as $type => $info) {
         if (array_key_exists($type, $this->count)) {
             $this->types[$type] = $info->get('name') . ' (' . $this->count[$type] . ')';
         }
     }
 }
开发者ID:blakefrederick,项目名称:sas-backend,代码行数:12,代码来源:DeleteContentForm.php

示例9: hook_permission_grid_info

/**
 * Declare this module's structured permissions.
 *
 * A set of structured permissions is defined as a list of objects and a list
 * of verbs. The permissions are created by combining these. For example, the
 * list of node types and the verbs (create, edit, delete) form a grid of
 * permissions for operations on all the node types.
 *
 * This hook may be placed in the file MODULE.permissions.inc.
 *
 * @return
 *  An array of data for object types that have multiple permissions associated
 *  with them. The array keys are object machine names, eg, 'node' (though note
 *  these need not be entities).
 *  Values are arrays with the following properties:
 *    - 'label': The human-readable label of the object type.
 *    - 'objects': An array of the different objects of this type that have
 *      their own permissions, for example, node types, which each provide
 *      permissions such as 'create foo node types'. These will form the rows 
 *      of the permissions grid. The keys are the substrings of the permission
 *      strings, and the values are human-readable labels.
 *    - 'verb_groups': An array of one or more verb groups. Each verb group
 *      defines a list of verbs and a pattern for the permissions using those
 *      verbs. The verb groups keys are arbitrary (but using the name of the
 *      providing module is a good idea for ease of alterability), and each
 *      array has the following properties:
 *      - 'verbs': An array of verbs. The keys are the 'machine names', that is,
 *        the strings that are replaced into the pattern. The values may be
 *        human-readable labels. Note that verb machine names must be unique
 *        across all the verb groups for the object type.
 *      - 'pattern': The pattern of the permissions machine name, with the
 *        following replacements:
 *        - '%verb': The verb of the permission. This takes all the keys in the
 *          verbs array in this verb group.
 *        - '%object': The object of the permission. This takes all the keys in
 *          the objects array.
 *      - 'object_process_callback' (optional) A function to process the object
 *        name before replacing it into the pattern. (This is just a hack for
 *        taxonomy to work.) 
 */
function hook_permission_grid_info()
{
    $return = array('node' => array('label' => t('Content type'), 'objects' => array(), 'verb_groups' => array('node' => array('pattern' => '%verb %object content', 'verbs' => array('create' => t('Create'), 'edit own' => t('Edit own'), 'edit any' => t('Edit any'), 'delete own' => t('Delete own'), 'delete any' => t('Delete any'))))));
    $node_types = node_type_get_types();
    $configured_types = node_permissions_get_configured_types();
    foreach ($configured_types as $type) {
        $return['node']['objects'][$type] = $node_types[$type]->name;
    }
    return $return;
}
开发者ID:chaunceyt,项目名称:website,代码行数:50,代码来源:permission_grid.api.php

示例10: getContentTypes

 function getContentTypes()
 {
     $types = array();
     $node = node_type_get_types();
     $node_types = new NodeTypes();
     foreach ($node as $key => $value) {
         $node_types->loadNode($value);
         $types[$key] = $node_types->getName();
     }
     return $types;
 }
开发者ID:mehulmakwana97,项目名称:Drupal-Module,代码行数:11,代码来源:UploadCSVForm.php

示例11: eldir_preprocess_node

/**
 * Preprocessor for theme_node().
 */
function eldir_preprocess_node(&$variables, $hook)
{
    if (!empty($variables['node'])) {
        // Add a node type label on node pages to help users.
        $types = node_type_get_types();
        $type = $variables['node']->type;
        if (!empty($types[$type])) {
            $variables['title'] = "<span class='label'>{$types[$type]->name}</span>" . $variables['title'];
        }
    }
}
开发者ID:srijanlabs,项目名称:assessment,代码行数:14,代码来源:template.php

示例12: ContentTypeExists

 /**
  * @Given /^"([^"]*)" Content Type exists$/
  */
 public function ContentTypeExists($type)
 {
     $types = node_type_get_types();
     foreach ($types as $contentType) {
         if ($contentType->name == $type) {
             $this->contentType = $contentType;
             break;
         }
     }
     assertNotEmpty($this->contentType);
 }
开发者ID:promet,项目名称:drupal-behat-extension,代码行数:14,代码来源:ContentTypeContext.php

示例13: buildForm

 /** 
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $config = $this->config('questions.settings');
     //echo "<pre>";
     // print_r(node_type_get_types());
     // exit;
     foreach (node_type_get_types() as $key => $value) {
         $options[$key] = $value->label();
     }
     $form['qus_content_type'] = array('#type' => 'select', '#default_value' => array($config->get('content_type')), '#options' => $options, '#title' => $this->t('Select content type'));
     return parent::buildForm($form, $form_state);
 }
开发者ID:National-Control-Devices,项目名称:questions-listing-page-module,代码行数:15,代码来源:questionsSettingsForm.php

示例14: getIdByArguments

 /**
  * @param string $title
  *   Inaccurate title of a node.
  * @param string $contentType
  *   Content type. Could be a title of content type.
  *
  * @return int
  *
  * @throws \InvalidArgumentException
  */
 public function getIdByArguments($title, $contentType = '')
 {
     $nid = new FetchField('node', 'nid');
     $nid->condition('title', "{$title}%", 'like');
     // Try to recognize node type by its title if content type specified and does not exist.
     if ('' !== $contentType && !isset(node_type_get_types()[$contentType])) {
         $contentType = (new FetchField('node_type', 'type'))->condition('name', $contentType)->execute();
         if ('' === $contentType) {
             throw new \InvalidArgumentException('Content type with such name does not exist!');
         }
         $nid->condition('type', $contentType);
     }
     return $nid->execute();
 }
开发者ID:BR0kEN-,项目名称:TqExtension,代码行数:24,代码来源:RawNodeContext.php

示例15: setUp

 protected function setUp()
 {
     parent::setUp();
     // Create an article content type only if it does not yet exist, so that
     // child classes may specify the standard profile.
     $types = node_type_get_types();
     if (empty($types['article'])) {
         $this->drupalCreateContentType(array('type' => 'article', 'name' => t('Article')));
     }
     // Create two test users.
     $this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer comments', 'administer comment types', 'administer comment fields', 'administer comment display', 'skip comment approval', 'post comments', 'access comments', 'access content'));
     $this->web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content', 'edit own comments', 'skip comment approval', 'access content'));
     // Create comment field on article.
     $this->container->get('comment.manager')->addDefaultField('node', 'article');
     // Create a test node authored by the web user.
     $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->id()));
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:17,代码来源:CommentTestBase.php


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