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


PHP BlockBase::blockForm方法代码示例

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


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

示例1: blockForm

 /**
  * {@inheritdoc}
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form = parent::blockForm($form, $form_state);
     // Add a form field to the existing block configuration form.
     $form['name'] = array('#type' => 'textfield', '#title' => t('Your Name'));
     return $form;
 }
开发者ID:KenG01,项目名称:Achieve-D8,代码行数:10,代码来源:MadLibsFormBlock.php

示例2: blockForm

 /**
  * {@inheritdoc}
  */
 public function blockForm($form, &$form_state)
 {
     $form = parent::blockForm($form, $form_state);
     $config = $this->getConfiguration();
     $form['demo_block_settings'] = array('#type' => 'textfield', '#title' => $this->t('Who'), '#description' => $this->t('Our custom block'), '#default_value' => isset($config['demo_block_settings']) ? $config['demo_block_settings'] : '');
     return $form;
 }
开发者ID:flesheater,项目名称:drupal8_modules_experiments,代码行数:10,代码来源:CustomBlock.php

示例3: blockForm

 /**
  * Overrides \Drupal\Core\Block\BlockBase::blockForm().
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form = parent::blockForm($form, $form_state);
     // Retrieve existing configuration for this block.
     $config = $this->getConfiguration();
     // Add a form field to the existing block configuration form.
     $form['flickr_items'] = array('#type' => 'select', '#title' => t('Number of items'), '#options' => array(10 => 10, 12 => 12, 15 => 15, 16 => 16, 18 => 18, 20 => 20), '#description' => t('Number of items that will be shown in the slideshow.'), '#default_value' => isset($config['flickr_items']) ? $config['flickr_items'] : '');
     //    $config = $this->configuration;
     //    $defaults = $this->defaultConfiguration();
     //    $form['flickr_items'] = array(
     //      '#type' => 'select',
     //      '#title' => t('Number of items'),
     //      '#options' => array(
     //        10 => 10,
     //        12 => 12,
     //        15 => 15,
     //        16 => 16,
     //        18 => 18,
     //        20 => 20
     //      ),
     //      '#description' => t('This number of items will be shown in the Flickr block'),
     //      '#default_value' => $config['flickr_items'],
     //    );
     //
     return $form;
 }
开发者ID:batigolix,项目名称:doesdesign8,代码行数:29,代码来源:Dd_toolsFlickr.php

示例4: blockForm

 /**
  * {@inheritdoc}
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form = parent::blockForm($form, $form_state);
     $config = $this->getConfiguration();
     $form['hello_block_settings'] = array('#type' => 'textfield', '#title' => $this->t('Who'), '#description' => $this->t('Who do you want to say hello to?'), '#default_value' => isset($config['hello_block_settings']) ? $config['hello_block_settings'] : '');
     return $form;
 }
开发者ID:narekcat,项目名称:Drupal_module_example,代码行数:10,代码来源:HelloBlock.php

示例5: blockForm

 /**
  * {@inheritdoc}
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form = parent::blockForm($form, $form_state);
     $config = $this->getConfiguration();
     $form['unibuc_weather_api_key'] = array('#type' => 'textfield', '#title' => $this->t('Api Key'), '#description' => $this->t('Apy Key for openweathermap.org'), '#default_value' => isset($config['unibuc_weather_api_key']) ? $config['unibuc_weather_api_key'] : '');
     $form['unibuc_weather_api_display'] = array('#type' => 'select', '#title' => $this->t('Display in'), '#options' => array('c' => 'C', 'f' => 'F'), '#description' => $this->t('How to display the temperature.'), '#default_value' => isset($config['unibuc_weather_api_display']) ? $config['unibuc_weather_api_display'] : '');
     return $form;
 }
开发者ID:eaudeweb,项目名称:curs-drupal-unibuc,代码行数:11,代码来源:LinksBlock.php

示例6: blockForm

 /**
  * {@inheritdoc}
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form = parent::blockForm($form, $form_state);
     // Retrieve existing configuration for this block.
     $config = $this->getConfiguration();
     // Add a form field to the existing block configuration form.
     $form['hello_text'] = array('#type' => 'textfield', '#title' => t('Hello text'), '#default_value' => isset($config['hello_text']) ? $config['hello_text'] : '');
     return $form;
 }
开发者ID:ttournie,项目名称:drupal8_tuto,代码行数:12,代码来源:HelloBlock.php

示例7: blockForm

 /**
  * {@inheritdoc}
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form = parent::blockForm($form, $form_state);
     // Retrieve existing configuration for this block.
     $config = $this->getConfiguration();
     // Add a form field to the existing block configuration form.
     $form['slideshow_items'] = array('#type' => 'select', '#title' => t('Number of items'), '#options' => array(3 => 3, 5 => 5, 7 => 7, 9 => 9, 11 => 11, 13 => 13, 15 => 15, 17 => 17), '#description' => t('Number of items that will be shown in the slideshow.'), '#default_value' => isset($config['slideshow_items']) ? $config['slideshow_items'] : '');
     $form['slideshow_order'] = array('#type' => 'select', '#title' => t('Order by'), '#options' => array('created ' => t('Creation date'), 'changed' => t('Date of last change')), '#description' => t('By which date the items will be ordered in the slideshow block'), '#default_value' => isset($config['slideshow_order']) ? $config['slideshow_order'] : '');
     return $form;
 }
开发者ID:batigolix,项目名称:doesdesign8,代码行数:13,代码来源:Dd_toolsSlideshow.php

示例8: blockForm

 /**
  * {@inheritdoc}
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form = parent::blockForm($form, $form_state);
     $config = $this->getConfiguration();
     $form['fc_applicationCode'] = array('#type' => 'textfield', '#title' => $this->t("Aplication Code"), '#description' => $this->t("Facebook App-id. If you do not know this see module information."), '#default_value' => isset($config['fc_applicationCode']) ? $config['fc_applicationCode'] : "", '#required' => TRUE);
     $form['fc_numPosts'] = array('#type' => 'textfield', '#title' => $this->t("Number comment display"), '#description' => $this->t("Number of comment display per page"), '#default_value' => isset($config['fc_numPosts']) ? $config['fc_numPosts'] : "10");
     $form['fc_width'] = array('#type' => 'textfield', '#title' => $this->t("Width size"), '#description' => $this->t("Maximum size for display on the page, if the size is in percent must include the symbol ( % )."), '#default_value' => isset($config['fc_width']) ? $config['fc_width'] : "100%");
     $form['fc_orderBy'] = array('#type' => 'radios', '#title' => $this->t("Order By"), '#options' => ['social' => $this->t('Social'), 'reverse_time' => $this->t('Desc'), 'time' => $this->t('Asc')], '#description' => $this->t("Select an order to display Comments."), '#default_value' => isset($config['fc_orderBy']) ? $config['fc_orderBy'] : "social");
     $form['fc_colorScheme'] = array('#type' => 'radios', '#title' => $this->t("Color Schema"), '#options' => ['light' => $this->t('Light'), 'dark' => $this->t('Dark')], '#description' => $this->t("Select a theme for display comment block."), '#default_value' => isset($config['fc_colorScheme']) ? $config['fc_colorScheme'] : "light");
     return $form;
 }
开发者ID:sail3,项目名称:facebook_comment,代码行数:14,代码来源:FacebookCommentBlock.php

示例9: blockForm

 /**
  * {@inheritdoc}
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form = parent::blockForm($form, $form_state);
     // Retrieve existing configuration for this block.
     $config = $this->getConfiguration();
     // Add a form field to the existing block configuration form.
     $form['org_name'] = array('#type' => 'textfield', '#title' => t('Organization:'), '#default_value' => isset($config['org_name']) ? $config['org_name'] : '');
     $form['org_loca'] = array('#type' => 'textfield', '#title' => t('Location:'), '#default_value' => isset($config['org_loca']) ? $config['org_loca'] : '');
     $form['org_mail'] = array('#type' => 'email', '#title' => t('Email ID:'), '#default_value' => isset($config['org_mail']) ? $config['org_mail'] : '');
     $form['org_phn'] = array('#type' => 'number', '#title' => t('Contact:'), '#default_value' => isset($config['org_phn']) ? $config['org_phn'] : '');
     $form['org_add'] = array('#type' => 'textfield', '#title' => t('Address:'), '#default_value' => isset($config['org_add']) ? $config['org_add'] : '');
     return $form;
 }
开发者ID:xaiwant,项目名称:D8custom-block-with-field-data,代码行数:16,代码来源:ContactBlock.php

示例10: blockForm

 /**
  * {@inheritdoc}
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form = parent::blockForm($form, $form_state);
     $config = $this->getConfiguration();
     $form['flickr_source'] = array('#type' => 'select', '#title' => t('Source pulling images'), '#default_value' => isset($config['flickr_source']) ? $config['flickr_source'] : 'user', '#description' => $this->t('Pulling from a Flickr user or Flickr group or Flickr user set or Tag'), '#options' => array('user' => 'User', 'group' => 'Group', 'user_set' => 'User set', 'all_tag' => 'Tag'));
     $form['flickr_userId'] = array('#type' => 'textfield', '#title' => $this->t('Flickr User ID:'), '#description' => $this->t('Input your Flickr User ID'), '#default_value' => isset($config['flickr_userId']) ? $config['flickr_userId'] : '', '#states' => array('visible' => array('select[name="settings[flickr_source]"]' => array('value' => t('user')))));
     $form['flickr_groupId'] = array('#type' => 'textfield', '#title' => $this->t('Flickr Group ID:'), '#description' => $this->t('Input your Flickr Group ID'), '#default_value' => isset($config['flickr_groupId']) ? $config['flickr_groupId'] : '', '#states' => array('visible' => array('select[name="settings[flickr_source]"]' => array('value' => t('group')))));
     $form['flickr_setId'] = array('#type' => 'textfield', '#title' => $this->t('Set ID:'), '#description' => $this->t('Input your Flickr Set ID'), '#default_value' => isset($config['flickr_setId']) ? $config['flickr_setId'] : '', '#states' => array('visible' => array('select[name="settings[flickr_source]"]' => array('value' => t('user_set')))));
     $form['flickr_tag'] = array('#type' => 'textfield', '#title' => $this->t('Tags:'), '#description' => $this->t('Each tag needs to be seperated by a comma'), '#default_value' => isset($config['flickr_tag']) ? $config['flickr_tag'] : '', '#states' => array('visible' => array('select[name="settings[flickr_source]"]' => array('value' => t('all_tag')))));
     $form['flickr_num_photo'] = array('#type' => 'select', '#title' => t('Number of images being pulled'), '#default_value' => isset($config['flickr_num_photo']) ? $config['flickr_num_photo'] : 4, '#description' => $this->t('How many images to show in Flickr block'), '#options' => array(2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9', 10 => '10'));
     $form['flickr_display'] = array('#type' => 'select', '#title' => $this->t('Ordering your images'), '#description' => $this->t('You can get random or latest images from Flickr'), '#options' => array('latest' => 'Latest Images', 'random' => 'Random Images'), '#default_value' => isset($config['flickr_display']) ? $config['flickr_display'] : 'latest');
     $form['flickr_image_size'] = array('#type' => 'select', '#title' => $this->t('Size of your images'), '#description' => $this->t('Small square box (75 pixels by 75 pixels), Thumbnail size (longest side is 100 pixels), and Medium size(longest side is 240 pixels)'), '#options' => array('t' => 'Thumbnail', 's' => 'Small', 'm' => 'Medium'), '#default_value' => isset($config['flickr_image_size']) ? $config['flickr_image_size'] : 't');
     $form['flickr_layout'] = array('#type' => 'select', '#title' => $this->t('Layout display images'), '#description' => $this->t('Layout can be horizontal or default div tag for render HTML output'), '#options' => array('x' => 'Default', 'h' => 'Horizontal'), '#default_value' => isset($config['flickr_layout']) ? $config['flickr_layout'] : 'x');
     return $form;
 }
开发者ID:nearlyheadlessarvie,项目名称:bloomingline,代码行数:18,代码来源:InnovationFlickr.php

示例11: blockForm

 /**
  * {@inheritdoc}
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form = parent::blockForm($form, $form_state);
     $config = $this->getConfiguration();
     $form['settings'] = array('#type' => 'details', '#title' => $this->t('Button settings'), '#open' => TRUE);
     $form['settings']['block_url'] = array('#type' => 'textfield', '#default_value' => $config['block_url'], '#description' => $this->t('URL of the page to like (could be your homepage or a facebook page e.g.)<br> You can also specify &lt;current&gt; to establish the url for the current viewed page in your site'));
     $form['appearance'] = array('#type' => 'details', '#title' => $this->t('Button appearance'), '#open' => FALSE);
     $form['appearance']['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['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['appearance']['show_faces'] = array('#type' => 'select', '#title' => $this->t('Display faces in the box'), '#options' => array(TRUE => $this->t('Show faces'), FALSE => $this->t('Do not show faces')), '#default_value' => $config['show_faces'], '#description' => $this->t('Show profile pictures below the button. Only works with Standard layout'));
     $form['appearance']['action'] = array('#type' => 'select', '#title' => $this->t('Verb to display'), '#options' => array('like' => $this->t('Like'), 'recommend' => $this->t('Recommend')), '#default_value' => $config['action'], '#description' => $this->t('The verb to display in the button.'));
     $form['appearance']['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['font'], '#description' => $this->t('The font to display in the button'));
     $form['appearance']['color_scheme'] = array('#type' => 'select', '#title' => $this->t('Color scheme'), '#options' => array('light' => $this->t('Light'), 'dark' => $this->t('Dark')), '#default_value' => $config['color_scheme'], '#description' => $this->t('The color scheme of box environtment'));
     $form['appearance']['language'] = array('#type' => 'textfield', '#title' => $this->t('Language'), '#default_value' => $config['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 $form;
 }
开发者ID:badelas,项目名称:afroweb,代码行数:20,代码来源:FblikebuttonBlock.php

示例12: blockForm

  /**
   * @param array $form
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   */
  public function blockForm($form, FormStateInterface $form_state) {
    $form = parent::blockForm($form, $form_state);
    $config = $this->getConfiguration();

    $form['hello_block_name'] = array(
      '#type' => 'textfield',
      '#title' => $this->t('Who'),
      '#default_value' => isset($config['name']) ? $config['name'] : '',
    );

    $form['hello_block_desc'] = array(
      '#type' => 'textarea',
      '#title' => $this->t('Desc'),
      '#default_value' => isset($config['desc']) ? $config['desc'] : '',
    );

    return $form;
  }
开发者ID:jno84,项目名称:drupal8,代码行数:22,代码来源:HelloBlock.php

示例13: blockForm

  /**
   * {@inheritdoc}
   */
  public function blockForm($form, FormStateInterface $form_state) {
    $form = parent::blockForm($form, $form_state);

    // Retrieve existing configuration for this block.
    $config = $this->getConfiguration();

    // Add a form field to the existing block configuration form.
    $options = array_combine(
      array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40),
      array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40)
    );
    $form['image_count'] = array(
      '#type' => 'select',
      '#title' => t('Number of images to display'),
      '#options' => $options,
      '#default_value' => isset($config['image_count']) ? $config['image_count'] : '',
    );
    return $form;
  }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:22,代码来源:PhotosRecentImages.php

示例14: blockForm

 /**
  * {@inheritdoc}
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form = parent::blockForm($form, $form_state);
     // Retrieve existing configuration for this block.
     $config = $this->getConfiguration();
     // Add a form field to the existing block configuration form.
     $form['mapbox_id'] = array('#type' => 'textfield', '#title' => t('Mapbox ID'), 'description' => 'ID given to you by mapbox as a user', '#default_value' => isset($config['mapbox_id']) ? $config['mapbox_id'] : '');
     $form['mapbox_accesstoken'] = array('#type' => 'textfield', '#title' => t('Access Token'), 'description' => 'The map access token provided by mapbox', '#default_value' => isset($config['mapbox_accesstoken']) ? $config['mapbox_accesstoken'] : '');
     $form['zoom_level'] = array('#type' => 'number', '#title' => t('Zoom Level'), 'description' => 'The Level of zoom (the higher the level, the closer)', '#default_value' => isset($config['zoom_level']) ? $config['zoom_level'] : '');
     $form['center'] = array('#type' => 'textfield', '#title' => t('Map Center'), 'description' => 'The coordinates, separated by comma, where to center the map.', '#default_value' => isset($config['center']) ? $config['center'] : '');
     $form['marker_popup'] = array('#type' => 'checkbox', '#title' => t('Marker Popup'), 'description' => 'Show a popup when clicking the marker.', '#default_value' => isset($config['marker_popup']) ? $config['marker_popup'] : '');
     $form['marker_view_mode'] = array('#type' => 'textfield', '#title' => t('Maker View Mode'), 'description' => 'View mode to be used when displaying in the popup.', '#default_value' => isset($config['marker_view_mode']) ? $config['marker_view_mode'] : '');
     $form['marker_legend'] = array('#type' => 'checkbox', '#title' => t('Marker Lengend'), 'description' => 'Enable the marker legend below the map.', '#default_value' => isset($config['marker_legend']) ? $config['marker_legend'] : '');
     $form['marker_cluster'] = array('#type' => 'checkbox', '#title' => t('Marker Clustering'), 'description' => 'Enabling clustering', '#default_value' => isset($config['marker_cluster']) ? $config['marker_cluster'] : '');
     $form['marker_proximity_search'] = array('#type' => 'checkbox', '#title' => t('Maker Proximity search'), 'description' => 'Enable the proximity search feature.', '#default_value' => isset($config['marker_proximity_search']) ? $config['marker_proximity_search'] : '');
     $form['marker_anchor'] = array('#type' => 'textfield', '#title' => t('Marker Anchor'), 'description' => 'What is considered to be the "tip" of the marker icon.', '#default_value' => isset($config['marker_anchor']) ? $config['marker_anchor'] : '');
     $form['marker_filter'] = array('#type' => 'checkbox', '#title' => t('Marker Filtering'), 'description' => 'Filter markers based on the "filter" attribute within the JSON.', '#default_value' => isset($config['marker_filter']) ? $config['marker_filter'] : '');
     $form['marker_filter_fields'] = array('#type' => 'textfield', '#title' => t('Marker Field Filters'), 'description' => 'Name of the field that acts as a fulter from the json. Separate multiple fields by a comma.', '#default_value' => isset($config['marker_filter_fields']) ? $config['marker_filter_fields'] : '');
     $form['marker_icon_src'] = array('#type' => 'textfield', '#title' => t('Maker Icon Path'), 'description' => 'Path to an image that will be used as a marker pin.', '#default_value' => isset($config['marker_icon_src']) ? $config['marker_icon_src'] : '');
     $form['marker_icon_width'] = array('#type' => 'number', '#title' => t('Marker Icon Width'), 'description' => 'Icon width in pixels.', '#default_value' => isset($config['marker_icon_width']) ? $config['marker_icon_width'] : '');
     $form['marker_icon_height'] = array('#type' => 'number', '#title' => t('Marker Icon Height'), 'description' => 'Icon height in pixels.', '#default_value' => isset($config['marker_icon_height']) ? $config['marker_icon_height'] : '');
     $form['data_path'] = array('#type' => 'number', '#title' => t('View Rest Path'), 'description' => 'Rest Based url path', '#default_value' => isset($config['data_path']) ? $config['data_path'] : '');
     return $form;
 }
开发者ID:AmazeeLabs,项目名称:mapbox,代码行数:27,代码来源:MapboxMap.php

示例15: blockForm

  /**
   * {@inheritdoc}
   */
  public function blockForm($form, FormStateInterface $form_state) {
    $form = parent::blockForm($form, $form_state);

    // Retrieve existing configuration for this block.
    // @todo convert variable 'photos_block_num_information_pager' to block config.
    $config = $this->getConfiguration();

    // Add a form field to the existing block configuration form.
    $form['show_sub_album'] = array(
      '#type' => 'radios',
      '#title' => t('Show sub-album info'),
      '#default_value' => isset($config['show_sub_album']) ? $config['show_sub_album'] : 0,
      '#options' => array(t('Disabled'), t('Enabled'))
    );

    return $form;
  }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:20,代码来源:PhotosInformation.php


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