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


PHP taxonomy_vocabulary_get_names函数代码示例

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


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

示例1: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm($form, FormStateInterface $form_state)
 {
     $config = $this->getConfiguration();
     $names = taxonomy_vocabulary_get_names();
     $vocabularies = Vocabulary::loadMultiple($names);
     // Should use dependency injection rather.
     $options = array();
     foreach ($vocabularies as $vocabulary) {
         $options[$vocabulary->id()] = $vocabulary->label();
     }
     $settings['vocabulary'] = array('#type' => 'select', '#title' => t('Vocabulary'), '#default_value' => $config['vocabulary'], '#options' => $options);
     return $settings;
 }
开发者ID:freefree12,项目名称:d8-demo-modules,代码行数:16,代码来源:VocabularyTerms.php

示例2: init

 /**
  * Overrides \Drupal\views\Plugin\views\Plugin\views\PluginBase::init().
  */
 public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
 {
     parent::init($view, $display, $options);
     // @todo Remove the legacy code.
     // Convert legacy vids option to machine name vocabularies.
     if (!empty($this->options['vids'])) {
         $vocabularies = taxonomy_vocabulary_get_names();
         foreach ($this->options['vids'] as $vid) {
             if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) {
                 $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name;
             }
         }
     }
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:17,代码来源:Tid.php

示例3: transform

 public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property)
 {
     $X = FALSE;
     $vocabularies = taxonomy_vocabulary_get_names();
     $vid = $this->configuration['vid'];
     $tid_qry = db_select('taxonomy_term_field_data', 't')->fields('t', array('tid'))->condition('name', $value)->execute();
     $db_row = $tid_qry->fetchAssoc();
     if ($db_row !== FALSE) {
         return $db_row['tid'];
     } else {
         trigger_error("Missing term '{$value}' under vid '{$vid}'", E_USER_WARNING);
         return '';
     }
 }
开发者ID:digitaldonkey,项目名称:donkeymedia_migrate,代码行数:14,代码来源:DonkeymediaTerms.php

示例4: fetchResults

 /**
  * Overrides LinkitSearchPluginEntity::fetchResults().
  */
 function fetchResults($search_string)
 {
     // The term entity doesn't use the entity keys bundle definition, its using
     // the vid instead, so lets 'translate' the bundle names to vids.
     if (isset($this->entity_key_bundle) && isset($this->conf['bundles'])) {
         $bundles = array_filter($this->conf['bundles']);
         // Get all vocabularies.
         $vocabularies = taxonomy_vocabulary_get_names();
         // Temp storage for values.
         $tmp_bundles = array();
         foreach ($bundles as $bundle) {
             $tmp_bundles[] = $vocabularies[$bundle]->{$this->entity_key_bundle};
         }
         // Assign the new values as the bundles.
         $this->conf['bundles'] = $tmp_bundles;
     }
     // Call the parent.
     return parent::fetchResults($search_string);
 }
开发者ID:CuBoulder,项目名称:cu-express-drops-7,代码行数:22,代码来源:taxonomy_term.class.php

示例5: build_json

function build_json($markerCluster, $options)
{
    $array_types = array();
    $typologies = null;
    if ($options['typology'] != null) {
        $array_types = explode(',', $options['typology']);
        $typologies = taxonomy_term_load_multiple($array_types);
    } else {
        // load taxonomy  'store_typology'
        $taxonomies_vocab = taxonomy_vocabulary_get_names();
        $typoTaxoVID = $taxonomies_vocab['store_typology']->vid;
        // Load store types (taxonomy vid=2)
        $type_options = array();
        $query = new EntityFieldQuery();
        $query->entityCondition('entity_type', 'taxonomy_term', '=')->propertyCondition('vid', $typoTaxoVID, '=');
        $result = $query->execute();
        if (!empty($result)) {
            $typologies = taxonomy_term_load_multiple(array_keys($result['taxonomy_term']));
        }
    }
    $json = array();
    global $base_url;
    $path_icon_cluster = $base_url . '/' . drupal_get_path('module', 'storelocator_ws') . "/images/";
    $index = 0;
    $count = 0;
    if ($options['macro'] != null && $options['macro'] == 'true') {
        foreach ($markerCluster->clusters as $cluster) {
            if (count($cluster->markers) > 1) {
                $json['results'][] = buildClusterMarkers($cluster, $index, $path_icon_cluster);
                $index++;
                $count += count($cluster->markers);
            } else {
                //print_r(count($cluster->getMarkers()));
                $json['results'][] = buildSimpleMarkers(reset($cluster->markers), $typologies);
                $count++;
            }
        }
    } else {
        foreach ($markerCluster->markers as $marker) {
            //print_r(count($cluster->getMarkers()));
            $json['results'][] = buildSimpleMarkers($marker, $typologies);
            $count++;
        }
    }
    $json['count'] = $count;
    return $json;
}
开发者ID:singhneeraj,项目名称:fr-store,代码行数:47,代码来源:gmaps-api.php

示例6: testTaxonomyVocabularyLoadMultiple

 /**
  * Tests for loading multiple vocabularies.
  */
 function testTaxonomyVocabularyLoadMultiple()
 {
     // Delete any existing vocabularies.
     foreach (Vocabulary::loadMultiple() as $vocabulary) {
         $vocabulary->delete();
     }
     // Create some vocabularies and assign weights.
     $vocabulary1 = $this->createVocabulary();
     $vocabulary1->set('weight', 0);
     $vocabulary1->save();
     $vocabulary2 = $this->createVocabulary();
     $vocabulary2->set('weight', 1);
     $vocabulary2->save();
     $vocabulary3 = $this->createVocabulary();
     $vocabulary3->set('weight', 2);
     $vocabulary3->save();
     // Check if third party settings exist.
     $this->assertEqual('bar', $vocabulary1->getThirdPartySetting('taxonomy_crud', 'foo'), 'Third party settings were added to the vocabulary.');
     $this->assertEqual('bar', $vocabulary2->getThirdPartySetting('taxonomy_crud', 'foo'), 'Third party settings were added to the vocabulary.');
     $this->assertEqual('bar', $vocabulary3->getThirdPartySetting('taxonomy_crud', 'foo'), 'Third party settings were added to the vocabulary.');
     // Fetch the names for all vocabularies, confirm that they are keyed by
     // machine name.
     $names = taxonomy_vocabulary_get_names();
     $this->assertEqual($names[$vocabulary1->id()], $vocabulary1->id(), 'Vocabulary 1 name found.');
     // Fetch the vocabularies with entity_load_multiple(), specifying IDs.
     // Ensure they are returned in the same order as the original array.
     $vocabularies = Vocabulary::loadMultiple(array($vocabulary3->id(), $vocabulary2->id(), $vocabulary1->id()));
     $loaded_order = array_keys($vocabularies);
     $expected_order = array($vocabulary3->id(), $vocabulary2->id(), $vocabulary1->id());
     $this->assertIdentical($loaded_order, $expected_order);
     // Test loading vocabularies by their properties.
     $controller = $this->container->get('entity.manager')->getStorage('taxonomy_vocabulary');
     // Fetch vocabulary 1 by name.
     $vocabulary = current($controller->loadByProperties(array('name' => $vocabulary1->label())));
     $this->assertEqual($vocabulary->id(), $vocabulary1->id(), 'Vocabulary loaded successfully by name.');
     // Fetch vocabulary 2 by name and ID.
     $vocabulary = current($controller->loadByProperties(array('name' => $vocabulary2->label(), 'vid' => $vocabulary2->id())));
     $this->assertEqual($vocabulary->id(), $vocabulary2->id(), 'Vocabulary loaded successfully by name and ID.');
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:42,代码来源:VocabularyCrudTest.php

示例7: array

$form['layout-config']['default-layouts'] = array('#type' => 'details', '#attributes' => array('class' => array('layout-selection')), '#title' => 'Default Layouts', '#group' => 'layout-config', '#states' => $omegaGSon);
$form['layout-config']['default-layouts']['default_layout'] = array('#prefix' => '<div class="default-layout-select">', '#suffix' => '</div>', '#description' => '<p class="description">The Default Layout is used on any/every page rendered by the <strong>' . $theme . '</strong> theme. Additional layouts can be used for other pages/sections as defined in the additional select options below.</p>', '#type' => 'select', '#attributes' => array('class' => array('layout-select', 'clearfix')), '#title' => 'Default: Select Layout', '#options' => $availableLayouts, '#default_value' => isset($defaultLayout) ? $defaultLayout : theme_get_setting('default_layout', $theme), '#tree' => FALSE, '#states' => $omegaGSon);
$homeLayout = isset($form_state->values['home_layout']) ? $form_state->values['home_layout'] : theme_get_setting('home_layout', $theme);
$form['layout-config']['default-layouts']['home_layout'] = array('#prefix' => '<div class="home-layout-select">', '#suffix' => '</div>', '#description' => '<p class="description">The Homepage Layout is used only on the home page rendered by the <strong>' . $theme . '</strong> theme.</p>', '#type' => 'select', '#attributes' => array('class' => array('layout-select', 'clearfix')), '#title' => 'Homepage: Select Layout', '#options' => $availableLayouts, '#default_value' => isset($homeLayout) ? $homeLayout : theme_get_setting('default_layout', $theme), '#tree' => FALSE, '#states' => $omegaGSon);
// Show a select menu for each node type, allowing the selection
// of an alternate layout per node type.
$form['layout-config']['node-layouts'] = array('#type' => 'details', '#attributes' => array('class' => array('layout-selection')), '#title' => 'Node Type Layouts', '#group' => 'layout-config', '#states' => $omegaGSon);
$types = node_type_get_types();
foreach ($types as $ctype => $ctypeData) {
    $layout_name = 'node_type_' . $ctype . '_layout';
    $ctypeLayout = theme_get_setting($layout_name, $theme);
    $form['layout-config']['node-layouts'][$layout_name] = array('#prefix' => '<div class="' . $ctype . '-layout-select">', '#suffix' => '</div>', '#type' => 'select', '#attributes' => array('class' => array('layout-select', 'clearfix')), '#title' => $ctypeData->label() . ': Select Layout', '#description' => '<p class="description">The <strong>' . $ctypeData->label() . '</strong> Layout is used only on pages rendering a full node page of the type "<strong>' . $ctypeData->id() . '</strong>" using the <strong>' . $theme . '</strong> theme.</p>', '#options' => $availableLayouts, '#default_value' => isset($ctypeLayout) ? $ctypeLayout : theme_get_setting('default_layout', $theme), '#tree' => FALSE, '#states' => $omegaGSon);
}
// create layout switching options for taxonomy term pages
$form['layout-config']['taxonomy-layouts'] = array('#type' => 'details', '#attributes' => array('class' => array('layout-selection')), '#title' => 'Taxonomy Term Page Layouts', '#group' => 'layout-config', '#states' => $omegaGSon);
$vocabs = taxonomy_vocabulary_get_names();
foreach ($vocabs as $vocab_id) {
    $vocab = taxonomy_vocabulary_load($vocab_id);
    //dsm($vocab->get('name'));
    $layout_name = 'taxonomy_' . $vocab_id . '_layout';
    $ttypeLayout = theme_get_setting($layout_name, $theme);
    $form['layout-config']['taxonomy-layouts'][$layout_name] = array('#prefix' => '<div class="' . $ttype . '-layout-select">', '#suffix' => '</div>', '#type' => 'select', '#attributes' => array('class' => array('layout-select', 'clearfix')), '#title' => $vocab->get('name') . ' Vocabulary: Select Layout', '#description' => '<p class="description">The <strong>' . $vocab->get('name') . '</strong> Layout is used only on pages rendering a full taxonomy term listing page of the type "<strong>' . $vocab_id . '</strong>" using the <strong>' . $theme . '</strong> theme.</p>', '#options' => $availableLayouts, '#default_value' => isset($ttypeLayout) ? $ttypeLayout : theme_get_setting('default_layout', $theme), '#tree' => FALSE, '#states' => $omegaGSon);
}
$form['layout-config']['views-layouts'] = array('#type' => 'details', '#description' => '<div class="messages messages--warning omega-styles-info">Currently, views layout switches are not available. This is a feature yet to be developed</div>', '#attributes' => array('class' => array('layout-selection')), '#title' => 'Views Page Layouts', '#group' => 'layout-config', '#states' => $omegaGSon);
/*
$view = \Drupal::routeMatch()->getParameter('view_id');
$viewData = Views::getView($view);

$allRouteViews = Views::getApplicableViews('uses_route');
dsm($allRouteViews);
开发者ID:edwardchan,项目名称:d8-drupalvm,代码行数:30,代码来源:layout-config.php

示例8: ardent_taxonomy_get_term_by_name

function ardent_taxonomy_get_term_by_name($name, $vocabulary = NULL)
{
    $conditions = array('name' => trim($name));
    if (isset($vocabulary)) {
        $vocabularies = taxonomy_vocabulary_get_names();
        if (isset($vocabularies[$vocabulary])) {
            $conditions['vid'] = $vocabularies[$vocabulary]->vid;
        } else {
            // Return an empty array when filtering by a non-existing vocabulary.
            return array();
        }
    }
    return taxonomy_term_load_multiple(array(), $conditions);
}
开发者ID:phpsubbarao,项目名称:test-core,代码行数:14,代码来源:template.php

示例9: getTypes

 public static function getTypes()
 {
     return taxonomy_vocabulary_get_names();
 }
开发者ID:wesnick,项目名称:drupal-bootstrap,代码行数:4,代码来源:VocabularyBuilder.php

示例10: callback_permission_grid_info_object_process

/**
 * Process an object name to use in a constructed permission string.
 *
 * @param $object_name
 *  The machine name of an object, as
 *
 * @return
 *  The string to use in the constructed permission machine string for the
 *  given object.
 */
function callback_permission_grid_info_object_process($object_name)
{
    $vocabulary_names = taxonomy_vocabulary_get_names();
    return $vocabulary_names[$object_name]->vid;
}
开发者ID:phpsubbarao,项目名称:test-core,代码行数:15,代码来源:permission_grid.api.php


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