• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP node_type_get_names函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: buildForm

 public function buildForm(array $form, FormStateInterface $form_state)
 {
     global $base_path;
     $addtoany_settings = $this->config('addtoany.settings');
     $button_img = '<img src="' . $base_path . drupal_get_path('module', 'addtoany') . '/images/%s" width="%d" height="%d"%s />';
     $button_options = array('default' => sprintf($button_img, 'a2a_32_32.svg', 32, 32, ' class="addtoany-round-icon"'), 'custom' => t('Custom button'), 'none' => t('None'));
     $attributes_for_code = array('autocapitalize' => array('off'), 'autocomplete' => array('off'), 'autocorrect' => array('off'), 'spellcheck' => array('false'));
     // Attach CSS and JS
     $form['#attached']['library'][] = 'addtoany/addtoany.admin';
     $form['addtoany_button_settings'] = array('#type' => 'details', '#title' => t('Buttons'), '#open' => TRUE);
     $form['addtoany_button_settings']['addtoany_buttons_size'] = array('#type' => 'number', '#title' => t('Icon size'), '#field_suffix' => ' ' . t('pixels'), '#default_value' => $addtoany_settings->get('buttons_size'), '#size' => 10, '#maxlength' => 3, '#min' => 8, '#max' => 999, '#required' => TRUE);
     $form['addtoany_button_settings']['addtoany_service_button_settings'] = array('#type' => 'details', '#title' => t('Service Buttons'), '#collapsible' => TRUE, '#collapsed' => TRUE);
     $form['addtoany_button_settings']['addtoany_service_button_settings']['addtoany_additional_html'] = array('#type' => 'textarea', '#title' => t('Service Buttons HTML code'), '#default_value' => $addtoany_settings->get('additional_html'), '#description' => t('You can add HTML code to display customized <a href="https://www.addtoany.com/buttons/customize/standalone_services" target="_blank">standalone service buttons</a> next to each universal share button. For example: <br /> <code>&lt;a class=&quot;a2a_button_facebook&quot;&gt;&lt;/a&gt;<br />&lt;a class=&quot;a2a_button_twitter&quot;&gt;&lt;/a&gt;<br />&lt;a class=&quot;a2a_button_pinterest&quot;&gt;&lt;/a&gt;</code>
   '), '#attributes' => $attributes_for_code);
     $form['addtoany_button_settings']['universal_button'] = array('#type' => 'details', '#title' => t('Universal Button'), '#collapsible' => TRUE, '#collapsed' => TRUE);
     $form['addtoany_button_settings']['universal_button']['addtoany_universal_button'] = array('#type' => 'radios', '#title' => t('Button'), '#default_value' => $addtoany_settings->get('universal_button'), '#attributes' => array('class' => array('addtoany-universal-button-option')), '#options' => $button_options);
     $form['addtoany_button_settings']['universal_button']['addtoany_custom_universal_button'] = array('#type' => 'textfield', '#title' => t('Custom button URL'), '#default_value' => $addtoany_settings->get('custom_universal_button'), '#description' => t('URL of the button image. Example: http://example.com/share.png'), '#states' => array('visible' => array(':input[name="addtoany_universal_button"]' => array('value' => 'custom'))));
     $form['addtoany_button_settings']['universal_button']['addtoany_universal_button_placement'] = array('#type' => 'radios', '#title' => t('Button placement'), '#default_value' => $addtoany_settings->get('universal_button_placement'), '#options' => array('after' => t('After the service buttons'), 'before' => t('Before the service buttons')), '#states' => array('invisible' => array(':input[name="addtoany_universal_button"]' => array('value' => 'none'))));
     $form['addtoany_placement_settings'] = array('#type' => 'details', '#title' => t('Placement'), '#collapsible' => TRUE, '#collapsed' => TRUE);
     $form['addtoany_placement_settings']['addtoany_nodetypes'] = array('#type' => 'checkboxes', '#title' => t('Node types'), '#description' => t('Display buttons for these node types.'), '#default_value' => !empty($addtoany_settings->get('nodetypes')) ? $addtoany_settings->get('nodetypes') : array(), '#options' => node_type_get_names());
     $form['addtoany_placement_settings']['addtoany_display_in_teasers'] = array('#type' => 'checkbox', '#title' => t('Display for node teasers'), '#default_value' => $addtoany_settings->get('display_in_teasers'), '#description' => t('Display buttons for node teasers in selected sections.'), '#states' => array('disabled' => array(':input[name="addtoany_display_in_nodecont"]' => array('checked' => FALSE))));
     $form['addtoany_placement_settings']['addtoany_display_in_nodecont'] = array('#type' => 'checkbox', '#title' => t('Display in content section'), '#default_value' => $addtoany_settings->get('display_in_nodecont'), '#description' => t('Display buttons in the content section of node pages.'));
     $form['addtoany_placement_settings']['addtoany_display_weight'] = array('#type' => 'weight', '#title' => t('Content weight'), '#default_value' => $addtoany_settings->get('display_weight'), '#delta' => 50, '#description' => t('Optional weight value for reordering AddToAny within the content section.'), '#states' => array('visible' => array(':input[name="addtoany_display_in_nodecont"]' => array('checked' => TRUE))));
     $form['addtoany_additional_settings'] = array('#type' => 'details', '#title' => t('Additional options'), '#collapsible' => TRUE, '#collapsed' => TRUE);
     $form['addtoany_additional_settings']['addtoany_additional_js'] = array('#type' => 'textarea', '#title' => t('Additional JavaScript'), '#default_value' => $addtoany_settings->get('additional_js'), '#description' => t('You can add special JavaScript code for AddToAny. See <a href="https://www.addtoany.com/buttons/customize/drupal" target="_blank">AddToAny documentation</a>.'), '#attributes' => $attributes_for_code);
     $form['addtoany_additional_settings']['addtoany_additional_css'] = array('#type' => 'textarea', '#title' => t('Additional CSS'), '#default_value' => $addtoany_settings->get('additional_css'), '#description' => t('You can add special CSS code for AddToAny. See <a href="https://www.addtoany.com/buttons/customize/drupal" target="_blank">AddToAny documentation</a>.'), '#attributes' => $attributes_for_code);
     $form['addtoany_additional_settings']['addtoany_no_3p'] = array('#type' => 'checkbox', '#title' => t('Disable 3rd party cookies'), '#default_value' => $addtoany_settings->get('no_3p'), '#description' => t('Disabling may affect analytics and limit some functionality.'));
     return parent::buildForm($form, $form_state);
 }
开发者ID:neetumorwani,项目名称:blogging,代码行数:29,代码来源:AddToAnySettingsForm.php


示例2: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $fblikebutton_node_options = node_type_get_names();
     $config = $this->config('fblikebutton.settings');
     $form['fblikebutton_dynamic_visibility'] = array('#type' => 'details', '#title' => $this->t('Visibility settings'), '#open' => TRUE);
     $form['fblikebutton_dynamic_visibility']['fblikebutton_node_types'] = array('#type' => 'checkboxes', '#title' => $this->t('Display the Like button on these content types:'), '#options' => $fblikebutton_node_options, '#default_value' => $config->get('node_types'), '#description' => $this->t('Each of these content types will have the "like" button automatically added to them.'));
     /** 
      * @TODO: Uncomment this when the module is also able to add the button to 
      * the links area
      * 
     $form['fblikebutton_dynamic_visibility']['fblikebutton_full_node_display'] = array(
       '#type' => 'radios',
       '#title' => $this->t('Where do you want to show the Like button (full node view)?'),
       '#options' => array(
         $this->t('Content area'),
         $this->t('Links area')
       ),
       '#default_value' => $config->get('full_node_display'),
       '#description' => $this->t('If <em>Content area</em> is selected, the button will appear in the same area as the node content. When you select <em>Links area</em> the Like button will be visible in the links area, usually at the bottom of the node (When you select this last option you may want to adjust the Appearance settings). You can also configure Static Like Button Blocks in'. \Drupal::l($this->t('block page'), Url::fromRoute('block.admin_display')) . '.'),
     );
     */
     $form['fblikebutton_dynamic_visibility']['fblikebutton_teaser_display'] = array('#type' => 'radios', '#title' => $this->t('Where do you want to show the Like button on teasers?'), '#options' => array($this->t('Don\'t show on teasers'), $this->t('Content area')), '#default_value' => $config->get('teaser_display'), '#description' => $this->t('If you want to show the like button on teasers you can select the display area.'));
     $form['fblikebutton_dynamic_appearance'] = array('#type' => 'details', '#title' => $this->t('Appearance settings'), '#open' => TRUE);
     $form['fblikebutton_dynamic_appearance']['fblikebutton_layout'] = array('#type' => 'select', '#title' => $this->t('Layout style'), '#options' => array('standard' => $this->t('Standard'), 'box_count' => $this->t('Box Count'), 'button_count' => $this->t('Button Count'), 'button' => $this->t('Button')), '#default_value' => $config->get('layout'), '#description' => $this->t('Determines the size and amount of social context next to the button.'));
     // The actial values passed in from the options will be converted to a boolean
     // in the validation function, so it doesn't really matter what we use.
     $form['fblikebutton_dynamic_appearance']['fblikebutton_show_faces'] = array('#type' => 'select', '#title' => $this->t('Show faces in the box?'), '#options' => array(t('Do not show faces'), $this->t('Show faces')), '#default_value' => $config->get('show_faces', TRUE), '#description' => $this->t('Show profile pictures below the button. Only works if <em>Layout style</em> (found above) is set to <em>Standard</em> (otherwise, value is ignored).'));
     $form['fblikebutton_dynamic_appearance']['fblikebutton_action'] = array('#type' => 'select', '#title' => $this->t('Verb to display'), '#options' => array('like' => $this->t('Like'), 'recommend' => $this->t('Recommend')), '#default_value' => $config->get('action'), '#description' => $this->t('The verbiage to display inside the button itself.'));
     $form['fblikebutton_dynamic_appearance']['fblikebutton_font'] = array('#type' => 'select', '#title' => $this->t('Font'), '#options' => array('arial' => 'Arial', 'lucida+grande' => 'Lucida Grande', 'segoe+ui' => 'Segoe UI', 'tahoma' => 'Tahoma', 'trebuchet+ms' => 'Trebuchet MS', 'verdana' => 'Verdana'), '#default_value' => $config->get('font', 'arial'), '#description' => $this->t('The font with which to display the text of the button.'));
     $form['fblikebutton_dynamic_appearance']['fblikebutton_color_scheme'] = array('#type' => 'select', '#title' => $this->t('Color scheme'), '#options' => array('light' => $this->t('Light'), 'dark' => $this->t('Dark')), '#default_value' => $config->get('color_scheme'), '#description' => $this->t('The color scheme of the box environtment.'));
     $form['fblikebutton_dynamic_appearance']['fblikebutton_weight'] = array('#type' => 'number', '#title' => $this->t('Weight'), '#default_value' => $config->get('weight'), '#description' => $this->t('The weight determines where, at the content block, the like button will appear. The larger the weight, the lower it will appear on the node. For example, if you want the button to appear more toward the top of the node, choose <em>-40</em> as opposed to <em>-39, -38, 0, 1,</em> or <em>50,</em> etc. To position the Like button in its own block, go to the ' . \Drupal::l($this->t('block page'), Url::fromRoute('block.admin_display')) . '.'));
     $form['fblikebutton_dynamic_appearance']['fblikebutton_language'] = array('#type' => 'textfield', '#title' => $this->t('Language'), '#default_value' => $config->get('language'), '#description' => $this->t('Specific language to use. Default is English. Examples:<br />French (France): <em>fr_FR</em><br />French (Canada): <em>fr_CA</em><br />More information can be found at http://developers.facebook.com/docs/internationalization/ and a full XML list can be found at http://www.facebook.com/translations/FacebookLocales.xml'));
     return parent::buildForm($form, $form_state);
 }
开发者ID:badelas,项目名称:afroweb,代码行数:37,代码来源:FblikebuttonFormSettings.php


示例3: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::buildForm($form, $form_state);
     $rate = $this->entity;
     $form['label'] = array('#type' => 'textfield', '#title' => $this->t('Label'), '#description' => $this->t('This name will appear to the customer when this tax is applied to an order.'), '#default_value' => $rate->label(), '#required' => TRUE);
     $form['id'] = array('#type' => 'machine_name', '#title' => $this->t('Machine name'), '#default_value' => $rate->id(), '#machine_name' => array('exists' => array($this, 'exists'), 'replace_pattern' => '([^a-z0-9_]+)|(^custom$)', 'error' => 'The machine-readable name must be unique, and can only contain lowercase letters, numbers, and underscores. Additionally, it can not be the reserved word "custom".'));
     $form['rate'] = array('#type' => 'textfield', '#title' => $this->t('Rate'), '#description' => $this->t('The tax rate as a percent or decimal. Examples: 6%, .06'), '#size' => 15, '#default_value' => (double) $rate->getRate() * 100.0 . '%', '#required' => TRUE);
     $form['jurisdiction'] = array('#type' => 'textfield', '#title' => $this->t('Jurisdiction'), '#description' => $this->t('Administrative label for the taxing authority, used to prepare reports of collected taxes.'), '#default_value' => $rate->getJurisdiction(), '#required' => FALSE);
     $form['shippable'] = array('#type' => 'radios', '#title' => $this->t('Taxed products'), '#options' => array(0 => $this->t('Apply tax to any product regardless of its shippability.'), 1 => $this->t('Apply tax to shippable products only.')), '#default_value' => (int) $rate->isForShippable());
     // TODO: Remove the need for a special case for product kit module.
     $options = array();
     foreach (node_type_get_names() as $type => $name) {
         if ($type != 'product_kit' && uc_product_is_product($type)) {
             $options[$type] = $name;
         }
     }
     $options['blank-line'] = $this->t('"Blank line" product');
     $form['product_types'] = array('#type' => 'checkboxes', '#title' => $this->t('Taxed product types'), '#description' => $this->t('Apply taxes to the specified product types/classes.'), '#default_value' => $rate->getProductTypes(), '#options' => $options);
     $options = array();
     foreach (_uc_line_item_list() as $id => $line_item) {
         if (!in_array($id, ['subtotal', 'tax_subtotal', 'total', 'tax_display'])) {
             $options[$id] = $line_item['title'];
         }
     }
     $form['line_item_types'] = array('#type' => 'checkboxes', '#title' => $this->t('Taxed line items'), '#description' => $this->t('Adds the checked line item types to the total before applying this tax.'), '#default_value' => $rate->getLineItemTypes(), '#options' => $options);
     $form['weight'] = array('#type' => 'weight', '#title' => $this->t('Weight'), '#description' => $this->t('Taxes are sorted by weight and then applied to the order sequentially. This value is important when taxes need to include other tax line items.'), '#default_value' => $rate->getWeight());
     $form['display_include'] = array('#type' => 'checkbox', '#title' => $this->t('Include this tax when displaying product prices.'), '#default_value' => $rate->isIncludedInPrice());
     $form['inclusion_text'] = array('#type' => 'textfield', '#title' => $this->t('Tax inclusion text'), '#description' => $this->t('This text will be displayed near the price to indicate that it includes tax.'), '#default_value' => $rate->getInclusionText());
     return $form;
 }
开发者ID:pedrocones,项目名称:hydrotools,代码行数:33,代码来源:TaxRateFormBase.php


示例4: permissions

 /**
  * Returns an array of ds switch view mode permissions.
  *
  * @return array
  */
 public function permissions()
 {
     $permissions = [];
     foreach (node_type_get_names() as $key => $name) {
         $permissions['ds switch ' . $key] = array('title' => $this->t('Switch view modes on :type', array(':type' => $name)));
     }
     return $permissions;
 }
开发者ID:neeravbm,项目名称:unify-d8,代码行数:13,代码来源:Permissions.php


示例5: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $types = node_type_get_names();
     $config = $this->config('book.settings');
     $form['book_allowed_types'] = array('#type' => 'checkboxes', '#title' => $this->t('Content types allowed in book outlines'), '#default_value' => $config->get('allowed_types'), '#options' => $types, '#description' => $this->t('Users with the %outline-perm permission can add all content types.', array('%outline-perm' => $this->t('Administer book outlines'))), '#required' => TRUE);
     $form['book_child_type'] = array('#type' => 'radios', '#title' => $this->t('Content type for the <em>Add child page</em> link'), '#default_value' => $config->get('child_type'), '#options' => $types, '#required' => TRUE);
     $form['array_filter'] = array('#type' => 'value', '#value' => TRUE);
     return parent::buildForm($form, $form_state);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:BookSettingsForm.php


示例6: testNodeTypeGetFunctions

 /**
  * Ensures that node type functions (node_type_get_*) work correctly.
  *
  * Load available node types and validate the returned data.
  */
 function testNodeTypeGetFunctions()
 {
     $node_types = node_type_get_types();
     $node_names = node_type_get_names();
     $this->assertTrue(isset($node_types['article']), 'Node type article is available.');
     $this->assertTrue(isset($node_types['page']), 'Node type basic page is available.');
     $this->assertEqual($node_types['article']->name, $node_names['article'], 'Correct node type base has been returned.');
     $article = entity_load('node_type', 'article');
     $this->assertEqual($node_types['article'], $article, 'Correct node type has been returned.');
     $this->assertEqual($node_types['article']->name, $article->label(), 'Correct node type name has been returned.');
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:16,代码来源:NodeTypeTest.php


示例7: settingsForm

 /**
  * {@inheritdoc}
  */
 public static function settingsForm($field, $instance)
 {
     $form = parent::settingsForm($field, $instance);
     $issue_node_types_options = array();
     $node_type_names = node_type_get_names();
     foreach ($node_type_names as $machine_name => $label) {
         if (project_issue_node_type_is_issue($machine_name)) {
             $issue_node_types[$machine_name] = $label;
         }
     }
     $form['target_bundles']['#options'] = $issue_node_types;
     return $form;
 }
开发者ID:washim,项目名称:techsupport,代码行数:16,代码来源:ProjectIssue_SelectionHandler_Issues.class.php


示例8: searchFormAlter

 /**
  * {@inheritdoc}
  */
 public function searchFormAlter(array &$form, FormStateInterface $form_state)
 {
     $parameters = $this->getParameters();
     $keys = $this->getKeywords();
     $used_advanced = !empty($parameters[self::ADVANCED_FORM]);
     if ($used_advanced) {
         $f = isset($parameters['f']) ? (array) $parameters['f'] : array();
         $defaults = $this->parseAdvancedDefaults($f, $keys);
     } else {
         $defaults = array('keys' => $keys);
     }
     $form['basic']['keys']['#default_value'] = $defaults['keys'];
     // Add advanced search keyword-related boxes.
     $form['advanced'] = array('#type' => 'details', '#title' => t('Advanced search'), '#attributes' => array('class' => array('search-advanced')), '#access' => $this->account && $this->account->hasPermission('use advanced search'), '#open' => $used_advanced);
     $form['advanced']['keywords-fieldset'] = array('#type' => 'fieldset', '#title' => t('Keywords'));
     $form['advanced']['keywords'] = array('#prefix' => '<div class="criterion">', '#suffix' => '</div>');
     $form['advanced']['keywords-fieldset']['keywords']['or'] = array('#type' => 'textfield', '#title' => t('Containing any of the words'), '#size' => 30, '#maxlength' => 255, '#default_value' => isset($defaults['or']) ? $defaults['or'] : '');
     $form['advanced']['keywords-fieldset']['keywords']['phrase'] = array('#type' => 'textfield', '#title' => t('Containing the phrase'), '#size' => 30, '#maxlength' => 255, '#default_value' => isset($defaults['phrase']) ? $defaults['phrase'] : '');
     $form['advanced']['keywords-fieldset']['keywords']['negative'] = array('#type' => 'textfield', '#title' => t('Containing none of the words'), '#size' => 30, '#maxlength' => 255, '#default_value' => isset($defaults['negative']) ? $defaults['negative'] : '');
     $form['advanced']['submit'] = array('#type' => 'submit', '#value' => t('Advanced search'), '#prefix' => '<div class="action">', '#suffix' => '</div>', '#weight' => 100);
     if (\Drupal::config("facets.facet_source.core_node_search__{$this->searchPageId}")->get('third_party_settings.core_search_facets.advanced_filters')) {
         // Add node types.
         $types = array_map(array('\\Drupal\\Component\\Utility\\Html', 'escape'), node_type_get_names());
         $form['advanced']['types-fieldset'] = array('#type' => 'fieldset', '#title' => t('Types'));
         $form['advanced']['types-fieldset']['type'] = array('#type' => 'checkboxes', '#title' => t('Only of the type(s)'), '#prefix' => '<div class="criterion">', '#suffix' => '</div>', '#options' => $types, '#default_value' => isset($defaults['type']) ? $defaults['type'] : array());
         $form['advanced']['submit'] = array('#type' => 'submit', '#value' => t('Advanced search'), '#prefix' => '<div class="action">', '#suffix' => '</div>', '#weight' => 100);
         // Add languages.
         $language_options = array();
         $language_list = $this->languageManager->getLanguages(LanguageInterface::STATE_ALL);
         foreach ($language_list as $langcode => $language) {
             // Make locked languages appear special in the list.
             $language_options[$langcode] = $language->isLocked() ? t('- @name -', array('@name' => $language->getName())) : $language->getName();
         }
         if (count($language_options) > 1) {
             $form['advanced']['lang-fieldset'] = array('#type' => 'fieldset', '#title' => t('Languages'));
             $form['advanced']['lang-fieldset']['language'] = array('#type' => 'checkboxes', '#title' => t('Languages'), '#prefix' => '<div class="criterion">', '#suffix' => '</div>', '#options' => $language_options, '#default_value' => isset($defaults['language']) ? $defaults['language'] : array());
         }
     }
 }
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:42,代码来源:NodeSearchFacets.php


示例9: edit_form

 function edit_form(&$form, &$form_state)
 {
     parent::edit_form($form, $form_state);
     $form['tag'] = array('#type' => 'textarea', '#title' => t('Tag'), '#default_value' => $form_state['item']->tag);
     $form['placement'] = array('#type' => 'select', '#title' => t('Placement'), '#default_value' => $form_state['item']->settings['placement'], '#options' => _springboard_tag_placement_options());
     $form['weight'] = array('#type' => 'weight', '#title' => t('Weight'), '#default_value' => $form_state['item']->weight, '#delta' => 10, '#description' => t('Optional. Set a heavier value to have a tag rendered below others in the document.'));
     // Visibility options.
     $form['visibility'] = array('#type' => 'container', '#tree' => TRUE);
     // Fundraiser visibility options.
     $form['visibility']['fundraiser'] = array('#type' => 'fieldset', '#title' => t('Fundraiser Visibility'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#access' => module_exists('fundraiser'));
     $form['visibility']['fundraiser']['confirmation'] = array('#type' => 'checkbox', '#title' => t('Show only on donation form confirmation pages'), '#default_value' => $form_state['item']->settings['visibility']['fundraiser']['confirmation']);
     // Fundraiser visibility options.
     $form['visibility']['user'] = array('#type' => 'fieldset', '#title' => t('User Visibility'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#access' => module_exists('fundraiser'));
     $role_options = array_map('check_plain', user_roles());
     $form['visibility']['user']['roles'] = array('#type' => 'checkboxes', '#title' => t('Exclude tag for specific user roles'), '#default_value' => $form_state['item']->settings['visibility']['user']['roles'], '#options' => $role_options, '#description' => t('Exclude this tag for the selected role(s). If you select no roles, the tag will be visible to all users.'));
     // Per-path visibility.
     $form['visibility']['path'] = array('#type' => 'fieldset', '#title' => t('Path Visibility'), '#collapsible' => TRUE, '#collapsed' => TRUE);
     $form['visibility']['path']['page_specific'] = array('#type' => 'radios', '#title' => t('Include tag on specific pages'), '#options' => array(BLOCK_VISIBILITY_NOTLISTED => t('All pages except those listed'), BLOCK_VISIBILITY_LISTED => t('Only the listed pages')), '#default_value' => $form_state['item']->settings['visibility']['path']['page_specific']);
     $form['visibility']['path']['pages'] = array('#type' => 'textarea', '#title' => 'Pages', '#default_value' => $form_state['item']->settings['visibility']['path']['pages'], '#description' => t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard."));
     // Per-node type visibility.
     $form['visibility']['node'] = array('#type' => 'fieldset', '#title' => t('Content Visibility'), '#collapsible' => TRUE, '#collapsed' => TRUE);
     $form['visibility']['node']['type'] = array('#type' => 'checkboxes', '#title' => t('Show tag for specific content types'), '#default_value' => $form_state['item']->settings['visibility']['node']['type'], '#options' => node_type_get_names(), '#description' => t('Show this tag only on nodes of the given type(s). If you select no types, there will be no type-specific limitation.'));
 }
开发者ID:JacksonRiver,项目名称:springboard_modules,代码行数:23,代码来源:springboard_tag_export_ui.class.php


示例10: hook_page_alter

 public function hook_page_alter(&$page)
 {
     // Add an extra "Panelizer" action on the content types admin page.
     if ($_GET['q'] == 'admin/structure/types') {
         // This only works with some themes.
         if (!empty($page['content']['system_main']['node_table'])) {
             // Shortcut.
             $table =& $page['content']['system_main']['node_table'];
             // Operations column should always be the last column in header.
             // Increase its colspan by one to include possible panelizer link.
             $operationsCol = end($table['#header']);
             if (!empty($operationsCol['colspan'])) {
                 $operationsColKey = key($table['#header']);
                 $table['#header'][$operationsColKey]['colspan']++;
             }
             // Since we can't tell what row a type is for, but we know that they
             // were generated in this order, go through the original types list.
             $types = node_type_get_types();
             $names = node_type_get_names();
             $row_index = 0;
             foreach ($names as $bundle => $name) {
                 $type = $types[$bundle];
                 if (node_hook($type->type, 'form')) {
                     $type_url_str = str_replace('_', '-', $type->type);
                     if ($this->is_panelized($bundle) && panelizer_administer_entity_bundle($this, $bundle)) {
                         $table['#rows'][$row_index][] = array('data' => l(t('panelizer'), 'admin/structure/types/manage/' . $type_url_str . '/panelizer'));
                     } else {
                         $table['#rows'][$row_index][] = array('data' => '');
                     }
                     // Update row index for next pass.
                     $row_index++;
                 }
             }
         }
     }
 }
开发者ID:stevebresnick,项目名称:iomedia_stp_d7_core,代码行数:36,代码来源:PanelizerEntityNode.class.php


示例11: blockForm

 /**
  * Overrides \Drupal\block\BlockBase::blockForm().
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     // Labels & default text.
     $form['search_box'] = array('#type' => 'details', '#title' => t('Search box'), '#open' => TRUE);
     $form['search_box']['label_visibility'] = array('#type' => 'checkbox', '#title' => t('Display label'), '#default_value' => $this->configuration['search_box']['label_visibility']);
     $form['search_box']['label'] = array('#type' => 'textfield', '#title' => t('Label'), '#default_value' => $this->configuration['search_box']['label'], '#description' => t('Enter the label text for the search box. The default value is "Search this site".'), '#states' => array('visible' => array(':input[name="settings[search_box][label_visibility]"]' => array('checked' => TRUE))));
     $form['search_box']['placeholder'] = array('#type' => 'textfield', '#title' => t('Placeholder text'), '#default_value' => $this->configuration['search_box']['placeholder'], '#description' => t('This will change the default text inside the search form. This is the <a href="http://www.w3schools.com/tags/att_input_placeholder.asp" target="_blank">placeholder</a> attribute for the TextField. Leave blank for no text. This field is blank by default.'));
     $form['search_box']['title'] = array('#type' => 'textfield', '#title' => t('Hint text'), '#default_value' => $this->configuration['search_box']['title'], '#description' => t('Enter the text that will be displayed when hovering the input field (HTML <em>title</em> attritube).'));
     $form['search_box']['size'] = array('#type' => 'textfield', '#title' => t('Size'), '#size' => 3, '#default_value' => $this->configuration['search_box']['size'], '#description' => t('The default value is "!default".', array('!default' => 15)));
     $form['search_box']['max_length'] = array('#type' => 'textfield', '#title' => t('Maximum length'), '#size' => 3, '#default_value' => $this->configuration['search_box']['max_length'], '#description' => t('The default value is "!default".', array('!default' => 128)), '#required' => TRUE);
     // Submit button.
     $form['submit'] = array('#type' => 'details', '#title' => t('Submit button'), '#open' => TRUE);
     $form['submit']['text'] = array('#type' => 'textfield', '#title' => t('Text'), '#default_value' => $this->configuration['submit']['text'], '#description' => t('Enter the text for the submit button. Leave blank to hide it. The default value is "Search".'));
     if ($this->moduleHandler->moduleExists('file')) {
         $form['submit']['image_path'] = array('#type' => 'textfield', '#title' => t('Image path'), '#description' => t('The path to the file you would like to use as submit button instead of the default text button.'), '#default_value' => $this->configuration['submit']['image_path']);
         $friendly_path = NULL;
         $default_image = 'search.png';
         if (\Drupal::service('file_system')->uriScheme($this->configuration['submit']['image_path']) == 'public') {
             $friendly_path = file_uri_target($this->configuration['submit']['image_path']);
         }
         if ($this->configuration['submit']['image_path'] && isset($friendly_path)) {
             $local_file = strtr($this->configuration['submit']['image_path'], array('public:/' => PublicStream::basePath()));
         } else {
             $local_file = \Drupal::theme()->getActiveTheme()->getPath() . '/' . $default_image;
         }
         $form['submit']['image_path']['#description'] = t('Examples: <code>@implicit-public-file</code> (for a file in the public filesystem), <code>@explicit-file</code>, or <code>@local-file</code>.', array('@implicit-public-file' => isset($friendly_path) ? $friendly_path : $default_image, '@explicit-file' => \Drupal::service('file_system')->uriScheme($this->configuration['submit']['image_path']) !== FALSE ? $this->configuration['submit']['image_path'] : 'public://' . $default_image, '@local-file' => $local_file));
         $form['submit']['image'] = array('#type' => 'file', '#title' => t('Image'), '#description' => t("If you don't have direct file access to the server, use this field to upload your image."));
     }
     // Content.
     $form['content'] = array('#type' => 'details', '#title' => t('Content'), '#description' => t("Select the search types to present as search options in the search block. If none is selected, no selector will be displayed. <strong>Note</strong>: if there's only one type checked, the selector won't be displayed BUT only this type will be searched."), '#open' => count(array_filter($this->configuration['content']['types'])) + count(array_filter($this->configuration['content']['excluded'])));
     $search_pages = entity_load_multiple('search_page');
     $pages_options = array();
     foreach ($search_pages as $page) {
         if ($page->getPlugin()->getPluginId() == 'node_search') {
             $pages_options[$page->id()] = $page->label();
         }
     }
     if (count($pages_options)) {
         $form['content']['page'] = array('#type' => 'select', '#title' => t('Search page'), '#description' => t('Select which page to use when searching content with this block. Pages are defined <a href="!link">here</a>.', array('!link' => Url::fromRoute('entity.search_page.collection', array(), array('fragment' => 'edit-search-pages'))->toString())), '#default_value' => $this->configuration['content']['page'], '#options' => $pages_options);
     }
     $form['content']['types'] = array('#type' => 'checkboxes', '#title' => t('Content types'), '#default_value' => $this->configuration['content']['types'], '#options' => node_type_get_names());
     $other_pages_options = array();
     foreach ($search_pages as $page) {
         if ($page->getPlugin()->getPluginId() != 'node_search') {
             $other_pages_options[$page->id()] = $page->label();
         }
     }
     if (count($other_pages_options)) {
         $form['content']['other'] = array('#type' => 'checkboxes', '#title' => t('Other search pages'), '#default_value' => $this->configuration['content']['other'], '#options' => $other_pages_options);
     }
     $form['content']['selector']['type'] = array('#type' => 'select', '#title' => t('Selector type'), '#options' => array('select' => t('Drop-down list'), 'selectmultiple' => t('Drop-down list with multiple choices'), 'radios' => t('Radio buttons'), 'checkboxes' => t('Checkboxes')), '#description' => t('Choose which selector type to use. Note: content types and other searches cannot be combined in a single search.'), '#default_value' => $this->configuration['content']['selector']['type']);
     $form['content']['selector']['label_visibility'] = array('#type' => 'checkbox', '#title' => t('Display label'), '#default_value' => $this->configuration['content']['selector']['label_visibility']);
     $form['content']['selector']['label'] = array('#type' => 'textfield', '#title' => t('Label text'), '#default_value' => $this->configuration['content']['selector']['label'], '#description' => t('Enter the label text for the selector. The default value is "Search for".'), '#states' => array('visible' => array(':input[name="settings[content][selector][label_visibility]"]' => array('checked' => TRUE))));
     $form['content']['any'] = array('#type' => 'details', '#title' => t('- Any -'));
     $form['content']['any']['text'] = array('#type' => 'textfield', '#title' => t('- Any content type - text'), '#default_value' => $this->configuration['content']['any']['text'], '#required' => TRUE, '#description' => t('Enter the text for "any content type" choice. The default value is "- Any -".'));
     $form['content']['any']['restricts'] = array('#type' => 'checkbox', '#title' => t('Choosing - Any - restricts the search to the selected content types.'), '#default_value' => $this->configuration['content']['any']['restricts'], '#description' => t('If not checked, choosing - Any - will search in all content types.'));
     $form['content']['any']['force'] = array('#type' => 'checkbox', '#title' => t('Force - Any - to be displayed.'), '#default_value' => $this->configuration['content']['any']['force'], '#description' => t('When only one content type is selected, the default behaviour is to hide the selector. If you need the - Any - option to be displayed, check this.'));
     $form['content']['excluded'] = array('#type' => 'checkboxes', '#title' => t('Content exclusion'), '#description' => t("Select the content types you don't want to be displayed as results."), '#default_value' => $this->configuration['content']['excluded'], '#options' => node_type_get_names());
     // Taxonomy.
     $vocabularies = entity_load_multiple('taxonomy_vocabulary');
     if (count($vocabularies)) {
         $open = FALSE;
         foreach ($vocabularies as $voc) {
             $vocId = $voc->id();
             if ($this->configuration['taxonomy'][$vocId]['type'] != 'disabled') {
                 $open = TRUE;
                 break;
             }
         }
         $form['taxonomy'] = array('#type' => 'details', '#title' => t('Taxonomy'), '#description' => t('Select the vocabularies to present as search options in the search block. If none is selected, no selector will be displayed.'), '#open' => $open);
         // Get vocabularies forms.
         foreach ($vocabularies as $voc) {
             $vocId = $voc->id();
             $form['taxonomy'][$vocId] = array('#type' => 'details', '#title' => $voc->label(), '#open' => $this->configuration['taxonomy'][$vocId]['type'] != 'disabled');
             $form['taxonomy'][$vocId]['type'] = array('#type' => 'select', '#title' => t('Selector type'), '#options' => array('disabled' => t('Disabled'), 'select' => t('Drop-down list'), 'selectmultiple' => t('Drop-down list with multiple choices'), 'radios' => t('Radio buttons'), 'checkboxes' => t('Checkboxes')), '#description' => t('Choose which selector type to use.'), '#default_value' => $this->configuration['taxonomy'][$vocId]['type']);
             $form['taxonomy'][$vocId]['depth'] = array('#type' => 'textfield', '#title' => t('Depth'), '#size' => 2, '#default_value' => $this->configuration['taxonomy'][$vocId]['depth'], '#description' => t('Define the maximum depth of terms being displayed. The default value is "0" which disables the limit.'));
             $form['taxonomy'][$vocId]['label_visibility'] = array('#type' => 'checkbox', '#title' => t('Display label'), '#default_value' => $this->configuration['taxonomy'][$vocId]['label_visibility']);
             $form['taxonomy'][$vocId]['label'] = array('#type' => 'textfield', '#title' => t('Label text'), '#default_value' => $this->configuration['taxonomy'][$vocId]['label'], '#description' => t('Enter the label text for the selector. The default value is "!default".', array('!default' => $voc->label())), '#states' => array('visible' => array(':input[name="settings[taxonomy][' . $vocId . '][label_visibility]"]' => array('checked' => TRUE))));
             $form['taxonomy'][$vocId]['all_text'] = array('#type' => 'textfield', '#title' => t('-Any- text'), '#default_value' => $this->configuration['taxonomy'][$vocId]['all_text'], '#required' => TRUE, '#description' => t('Enter the text for "any term" choice. The default value is "- Any -".'));
         }
     }
     // Criteria.
     $form['criteria'] = array('#type' => 'details', '#title' => t('Advanced search criteria'), '#open' => $this->configuration['criteria']['or']['display'] || $this->configuration['criteria']['phrase']['display'] || $this->configuration['criteria']['negative']['display']);
     $form['criteria']['or'] = array('#type' => 'details', '#title' => t('Or'), '#open' => $this->configuration['criteria']['or']['display']);
     $form['criteria']['or']['display'] = array('#type' => 'checkbox', '#title' => t('Display'), '#default_value' => $this->configuration['criteria']['or']['display']);
     $form['criteria']['or']['label'] = array('#type' => 'textfield', '#title' => t('Label'), '#default_value' => $this->configuration['criteria']['or']['label'], '#description' => t('Enter the label text for this field. The default value is "Containing any of the words".'), '#states' => array('visible' => array(':input[name="settings[criteria][or][display]"]' => array('checked' => TRUE))));
     $form['criteria']['phrase'] = array('#type' => 'details', '#title' => t('Phrase'), '#open' => $this->configuration['criteria']['phrase']['display']);
     $form['criteria']['phrase']['display'] = array('#type' => 'checkbox', '#title' => t('Display'), '#default_value' => $this->configuration['criteria']['phrase']['display']);
     $form['criteria']['phrase']['label'] = array('#type' => 'textfield', '#title' => t('Label'), '#default_value' => $this->configuration['criteria']['phrase']['label'], '#description' => t('Enter the label text for this field. The default value is "Containing the phrase".'), '#states' => array('visible' => array(':input[name="settings[criteria][phrase][display]"]' => array('checked' => TRUE))));
     $form['criteria']['negative'] = array('#type' => 'details', '#title' => t('Negative'), '#open' => $this->configuration['criteria']['negative']['display']);
     $form['criteria']['negative']['display'] = array('#type' => 'checkbox', '#title' => t('Display'), '#default_value' => $this->configuration['criteria']['negative']['display']);
     $form['criteria']['negative']['label'] = array('#type' => 'textfield', '#title' => t('Label'), '#default_value' => $this->configuration['criteria']['negative']['label'], '#description' => t('Enter the label text for this field. The default value is "Containing none of the words".'), '#states' => array('visible' => array(':input[name="settings[criteria][negative][display]"]' => array('checked' => TRUE))));
     // Search API support.
     if ($this->moduleHandler->moduleExists('search_api_page')) {
         $search_api_pages = search_api_page_load_multiple();
         $options[0] = t('None');
         foreach ($search_api_pages as $page) {
//.........这里部分代码省略.........
开发者ID:augustpascual-mse,项目名称:job-searching-network,代码行数:101,代码来源:CustomSearchBlock.php


示例12: hook_fieldable_info

/**
 * Inform the Field API about one or more fieldable types.
 *
 * Inform the Field API about one or more fieldable types, (object
 * types to which fields can be attached).
 *
 * @return
 *   An array whose keys are fieldable object type names and
 *   whose values identify properties of those types that the Field
 *   system needs to know about:
 *
 *   name: The human-readable name of the type.
 *   id key: The object property that contains the primary id for the
 *     object. Every object passed to the Field API must
 *     have this property and its value must be numeric.
 *   revision key: The object property that contains the revision id
 *     for the object, or NULL if the object type is not
 *     versioned. The Field API assumes that all revision ids are
 *     unique across all instances of a type; this means, for example,
 *     that every object's revision ids cannot be 0, 1, 2, ...
 *   bundle key: The object property that contains the bundle name for
 *     the object (bundle name is what nodes call "content type").
 *     The bundle name defines which fields are connected to the object.
 *   cacheable: A boolean indicating whether Field API should cache
 *     loaded fields for each object, reducing the cost of
 *     field_attach_load().
 *   bundles: An array of all existing bundle names for this object
 *     type. TODO: Define format. TODO: I'm unclear why we need
 *     this.
 */
function hook_fieldable_info()
{
    $return = array('node' => array('name' => t('Node'), 'id key' => 'nid', 'revision key' => 'vid', 'bundle key' => 'type', 'cacheable' => FALSE, 'bundles' => node_type_get_names()));
    return $return;
}
开发者ID:veggieryan,项目名称:drupal,代码行数:35,代码来源:field.api.php


示例13: validateDrushParams

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP node_type_get_type函数代码示例发布时间:2022-05-15
下一篇:
PHP node_type_get_name函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap