texts: Theme's css and js files are not being loaded

texts:
I was trying to create a theme for Drupal 8.1.8. My CSS and JS files unfortunately cannot be loaded. I have checked if I used any tab characters, but I have used always 2 space characters for an indent.

I have read the documentation page at Drupal.org: https://www.drupal.org/theme-guide/8/assets. I was trying around 2 hours with all possible combination. Also I tried the google search, Drupal core code inspection.. I could not figure it out.

My theme is located at themes/englishtrainer. The css is located in themes/englishtrainer/css and the javascript files are in themes/englishtrainer/js. The theme can be enabled as a theme without problems.

The contents of my theme's files in the following.

englishtrainer.info.yml:

name: Englishtrainer
type: theme
version: 8.x-1.0
core: 8.x
package: Custom
# Scripts & Styles
libraries:
  - englishtrainer/global-styling

englishtrainer.libraries.yml:

global-styling:
  version: 1.x
  css:
    theme:
      css/css-test.css: {}
  js:
    js/js-test.js: {}

css/css-test.css:

body {
    background-color: red;
}

js/js-test.js:

alert('it is loaded!');

I was checking the html markup for any occurrences. The javascript console has been also checked. It does not contain any entries.

Do you have any idea?


texts:
On my home page there are four links: Home, Contact Us, Company News, and Login.

I want Login and Company News to use SSL Certification.

How can I achieve this?


texts:
I'm using Drupal with CloudFront CND. Drupal works very well without CloudFront, but I get an error when I try to login in my website after enable CloudFront, the user is ok, the pass is ok but I get 'Access Denied".

This happen always when I enable CloudFront. Also, If I change my host file and I set my server's ip pointing to my address I can get access.

I was thinking that it could be a problem with CloudFront and I check if my CloudFront allow POST method (it allows all). After that I check the CDN options and I think that maybe I can set some type of whitlist to avoid to get my website from CloudFront, for expample, if I go to the url "www.mywebsite.com/login", it would be served from the server and not from CloudFront.

I check if I can do it added to this option: DRUPAL PATH FOR AUTHENTICATED USERS, but it doesnt works adding "admin*" or "user*", I use /user to login and admin the website.

Someone can help me?


texts:
We have a mytheme.theme file that has a mytheme_preprocess_node(&$variables) function. Within this preprocess hook, we would like to remove all HTML tags within a formatted (long) field. The goal is to do without using striptags within the node--page.html.twig template.

How can we do this securely without using striptags in a twig template?

Here is what we tried, but cannot find how to do it using mytheme_preprocess_node hook.

mytheme.theme

function mytheme_preprocess_node(&$variables) {

  $node = $variables['node'];
  $field_value = $node->get('body')->first()->getValue()['value'];
  ksm($field_value);
  // cannot find way to remove `html` tags

  $variables['field_value'] = $field_value;
}

node--page.html.twig

{{ field_value }}

output of ksm($field_value)

"& lt;p & gt;When looking at & lt;a href=&quot;https://www.example.com/some-path/&quot;& gt;article trends& lt;/a& gt; over time, attacks are cyclical in nature. Attackers develop new attack types and vectors, which are used to launch a new wave of attacks. As defenders become more proficient in stopping these new attacks, the attackers develop new types of attacks and the cycle repeats itself.&lt;/p& gt;

In order to properly display the output, I had to a space between & and lt characters above because StackExchange will convert those to proper tags. Within the ksm statement there is no space.

Additional item we tried within a twig template, but not sure if it is secure.

{% set body_processed = {
  '#type' : 'processed_text',
  '#text' : content.body.0,
  '#format' : content.body.format
} %}


texts: Do not map (update) some fields with migrate in update action

texts:
I have a custom migrate import that imports some fields like:

...
$this->addFieldMapping('title', 'title');
$this->addFieldMapping('body', 'description');
$this->addFieldMapping('created', 'created');
...

If I run an update of some items (the source data is a live site) I don't want to update the title or body fields because editors are changing this content in the drupal site.

I'm using this workarround but I'm not sure this is the best way to do this:

/**
 * Migrate prepare method.
 */
public function prepare($entity, $row) {
  if (isset($entity->is_new) && $entity->is_new === FALSE) {
    unset($entity->body);
    unset($entity->title);
  }
}

Thanks!


texts: Display Suite: Panel layouts in doesn't appear in "Manage fields"

texts:
I can select panel layouts using display suite in the manage display tab, but only display suite layouts are available in the manage fields tab but none of the panels layouts are.

Can you please help me with this problem?


texts:
Ive added a custom comment field to comments of my node i.e. new fields beneath comment_body that being field_flag_reason and field_unflag_reason

I want to hide these two fields for specific roles so I'm looking to use a hook with the logic to display when appropriate, the difficulty I'm having is I'm confused as to what element I should be trying to target in the rendered array and any changes I try don't seem to take effect, think I might be going about it the wrong way, any help would be greatly appreciated.


texts: Migrating database content to a new server

texts:
I am moving a Drupal site onto a new server. I am using putty to scp the database onto this new server; I have not done this before, so there are things I am not sure.

There is a database called 'website' in the mysql on the server already, while my original database name is actually 'mydrupalsite'. If I just import the file mydrupalsite.sql into database 'website', and change the database name in setting.php, will that be ok?


texts:
I'm new to using the Webform module, and started with the Contact form provided on install. I have added a Webform block to the Content region, but it doesn't show up on the front-end at all (even when I remove all restrictions such as only showing on certain pages).
I thought it might be a permissions issue, so I checked that all roles have access to see the form. When I tick "Allow users to post submissions from a dedicated URL" and choose a path, both anonymous and logged-in users can view the form at that URL. It's only when it's a block that it doesn't show up. I have also tried clearing the cache, and placing the block in other regions.
I am using Drupal 9 with Webform 6.0.0.
Edit: After some suggestions below I have also tried:

Another theme: The issue does not happen in the parent theme of my sub-theme, narrowing it down to a possible theme-level issue.
Deleting my theme's overrides of region.html.twig and block.html.twig. The issue persists in my theme.
Placing a HTML comment in block.html.twig before any Twig code, to check when that file is being used (i.e. it might be loaded, but have a problem with the output code). It is not rendered at all for this specific block.

What are some other possible things that can cause the block to not show up?


texts: Drupal 8 Custom Twig Templates not being loaded

texts:
I am working on a website which has pages with dynamic google maps, which has made it necessary for me to make use of custom page templates. I ran into a issue earlier today and been trying to find a way around it for hours now:

I have two pages that I need to create templates for(lets call them /dash_a and /dash_b). I created a twig template saved as page--dash_a.html.twig which loads correctly when I navigate to the page on the website. Now I created the page--dash_b.html.twig but it doesn't load the template on this page surprisingly. It actually uses the page.html.twig template. I have tried the following:

Cleared all caches numerous times
Deleted the page /dash_b and recreated it
Disable Caching on the website
copied the content of page--dash_a.html.twig into page--dash_b.html.twig, cleared cache and refreshed page just to be sure there is no error in my twig file.
Created another page /dash_c and created a corresponding page--dash_c.html.twig to see if it will work but that too didn't work.

None of these could resolve my issue. Please what else is there to do to resolve this issue as it has robbed me of a whole day's work already. Any help will be appreciated.

P.S.: I am very new to Drupal and this is my first website on the platform, but I have used DNN extensively in the past.


texts: Stuck with Drush on OS X with AMPPS and Homebrew

texts:
I am setting up a new development environment on a local machine and am using AMPPS. I have installed Drush using Homebrew and am running a Mac (OS X 10.12.5 Sierra).

I have successfully installed a fresh Drupal site in my development environment. When I attempt to run a drush command, I get the Drush status along with the classic bootstrap/jailed shell message:

Command pm-list needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal[error]
environment to run this command.
The drush command 'pm-list' could not be executed.                                                                 [error]
Drush was not able to start (bootstrap) the Drupal database.                                                       [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a configured database. In this case you can select
another site with a working database setup by specifying the URI to use with the --uri parameter on the command
line. See `drush topic docs-aliases` for details.
 * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a
jailed shell. See http://drupal.org/node/1428638 for details.

Here is the output of drush status:

Drush was attempting to connect to:
 Drupal version         :  7.54
 Site URI               :  http://default
 Database driver        :  mysql
 Database hostname      :  localhost
 Database port          :
 Database username      :  myuser
 Database name          :  drupal
 PHP executable         :  /Applications/AMPPS/php-5.6/bin/php
 PHP configuration      :  /Applications/AMPPS/php-5.6/etc/php.ini
 PHP OS                 :  Darwin
 Drush script           :  /usr/local/Cellar/drush/8.1.15/libexec/drush.php
 Drush version          :  8.1.15
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Applications/AMPPS/www/drupal/docroot
 Drupal Settings File   :  sites/default/settings.php
 Site path              :  sites/default

Please note:

I have tried changing localhost to 127.0.0.1 in sites/default/settings.php and restarting the server
I added the path to drush to php via export DRUSH_PHP=/Applications/AMPPS/php-5.6/bin/php
I am executing the command within the docroot of the drupal installation
I do not have a ~/.my.cnf file
symlink in /usr/local/bin for PHP goes to Homebrew's instead of AMPPS's but it's for version 7.1.10 and I'm using PHP 5.6

There are a lot of posts on this with slightly different details or environments and I'm having no luck deriving a solution from those so I thought I would post my issue with the specific scenario.

I mostly used these instructions:
https://www.drupal.org/node/954766


texts: When creating a custom form, how does one store the data in drupal db and then retrieve for display?

texts:
I'm new to Drupal and things that seem easy are apparently abstracted to oblivion.

I've created a module that displays a survey form. I would like to collect the data and store it in the database, and then allow the admin of the site to view the data that has been collected.

What is the "Drupal way" to do this?

Thank you in advance!

<?php

function member_survey_menu() {

  $items['member_survey'] = array(
    'title' => t('Member Survey'),
    'page callback' => 'member_survey_form',
    'access arguments' => array('access content'),
  );
  return $items;

}

function member_survey_form(){

    $output = drupal_get_form('member_survey_my_form');
    return $output;
}

function member_survey_my_form($form_state){
    # the options to display in our form radio buttons
    $options1 = array(
      'Strongly Agree' => t('Strongly Agree'),
      'Agree' => t('Agree'),
      'Neutral' => t('Neutral'),
      'Disagree' => t('Disagree'),
      'Strongly Disagree' => t('Strongly Disagree'),
    );

    # the options to display in our form radio buttons
    $options2 = array(
      'Very Satisfied ' => t('Very Satisfied '),
      'Satisfied' => t('Satisfied '),
      'Neither Satisfied or Dissatisfied' => t('Neither Satisfied or Dissatisfied'),
      'Dissatisfied ' => t('Dissatisfied '),
      'Very Dissatisfied ' => t('Very Dissatisfied '),
    );

    $form['knowledgable'] = array(
      '#type' => 'radios',
      '#title' => t('Question 1'),
      '#options' => $options1,
      //'#default_value' => $options['Neutral'],
    );

    $form['satisfied'] = array(
      '#type' => 'radios',
      '#title' => t('Question 4'),
      '#options' => $options2,
      //'#default_value' => $options['Neutral'],
    );

    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit'),
    );

  return $form;
}

// Validate the form submission
function member_survey_my_form_validate($form, &$form_state){
    if(empty($form_state['values']['knowledgable']) ||
        empty($form_state['values']['satisfied'])
    ){
        form_set_error('knowledgable',t('Please respond to all questions, thank you!'));
    }

}

?>


texts: Drupal won't update textfield from a integer value with no decimal to the same value with a .0 decimal

texts:
I am facing a strange situation in Drupal 8 where the value of a text field won't be updated in some situations.

Indeed, if the textfield's value is an integer, for instance 19 and I try to update it for a decimal with a .0 (for instance 19.0) then it won't be updated. (My guess is that Drupal takes those 2 values as the same, and so doesn't update the database). The same problem happen if I try to update from 19.0 to 19.

However if I update the value from 19 or 19.0 to any other value (let's say 19.1) and then go back to 19.0 or 19, then it will be updated since the numerical value has been different between the two values I am trying to update.

What's strange is that the field I am using is a textfield, and so the string value "19" isn't supposed to equals "19.0". I would understand why a numerical field was not updated (since the value is numerically the same) but this shouldn't be the case in a textfield.

My question is, has anybody ever faced a situation like that in Drupal and is there a possible workaround ? The difference between those two values is important in my situation (even if it is numerically the same)...


texts: Search api, postprocess processor: how re-run the query?

texts:
The documentation of the search api module says, about postprocess processor:

Postprocess query
This is probably the rarest phase for processors to
use, postprocessing the query after it has run to manipulate the
search results in some way. A prominent example would be the
"Highlight" processor, which highlights the search keywords in the
returned results. But this phase could also be used, for example, to
re-run the query completely with some changes in case no results were
found the first time.

However, it doesn't explain how to re-run the query completely.
I've to implement exactly in the case described: I've a search api view, with a fulltext search exposed filter and some facets.
If the query returns no results, I need to re-run it with some changes on the conditions provided by one of the facet filters (the content type), before actually rendering the result page.
This must be done programmatically and not by user interaction.
I've checked the ProcessorInterface but the only relative method seems to be the function postprocessSearchResults(ResultSetInterface $results);.
Highligh, the only processor implementing a postprocess_query stage doesn't do anything similar at what I need to do.
Any idea how I could re-run the query? I'm on a D9 site. Alternative solutions to the problem would be useful too, I'm trying this way as the documentation gives the idea it is a possible solution.


texts:
I actually import terms from Feeds Xpath and copy them to a Content taxonomy field. But this term isn't recorded in the term_node table as expected by checking the checkbox.

So can I use Rules to "force" this recording in the term_node table from the data stored by CCK Content Taxonomy ?
If yes, how can I do that ?

thanks


texts: How can I make a feature with organic groups, spaces, context in drupal 7

texts:
I'm trying to build features that behave as follows:

Enabling the feature on the Features tab of the group turns on the relevant create content links, and menu items

Disabling the feature removes the create content link and hides the menu items from the features menu.

Currently enabling/disabling a feature that I have created does not hide/show the create content links or menu items.  If the content was created while the feature is enabled, the view does not go away when disabling the feature.

I have features, context, organic groups, spaces, and purl installed.  I think the issue stems from a missing context.  I would like the feature to be isolated to each group space.


texts: Make a custom block to render a published content

texts:
Is there way to make a custom block displays a list of published contents?

I tried...

Create a new block type with just one field of type Reference->content.
Create a new block with recently created type.
Configure visibility -> type of content to a particular type of content on this recently created block.
Place block in block layout.
Publish a new content.

But at the end nothing is rendered on my page.

Drupal 8 question.


texts: Is Drupal appropriate for what I want to do?

texts:
I am building a simple portfolio site for a friend. The vast majority of the site will be static, but I'd like to implement a kind of news/mini-blog on the front page, just two divs where he can update the site with his latest news.

Is Drupal overkill for implementing this kind of thing? Moreover, how simple would it be to set up; I have no CMS experience whatsoever.


texts: Currently there is a .drush folder in my user profile on my mac. However, is it possible to move it into my git repo? How does one move it? If I drag and drop it, then run a drush command, the folder is remade in my user profile folder.


texts: Local tasks not correctly limited to base_route

texts:
I want to create a customized media library for my editors, with a tab navigation similar to the tabs on core's admin/content view. It basically works, but I also want to add a tab leading to a specific "media" taxonomy vocabulary used by my media entities. As soon as I add the taxonomy tab to my YML file, the base_route filter no longer works.

Screenshot with correct behaviour on view pages:

Screenshot with unwanted tabs on taxonomy page:

This is my custom modules' links.task.yml.

# a common view page for all media types
wt_media.media_list:
  route_name: view.medialibrary.medialibrary
  base_route: view.medialibrary
  title: 'All media types'
# a view page only for images
wt_media.image_list:
  route_name: view.medialibrary.imagelibrary
  base_route: view.medialibrary
  title: Images
# a view page only for videos
wt_media.video_list:
  route_name: view.medialibrary.videolibrary
  base_route: view.medialibrary
  title: Videos
# a view page only for documents/files
wt_media.file_list:
  route_name: view.medialibrary.filelibrary
  base_route: view.medialibrary
  title: Documents
# as soon as I activate the following entry, all the tabs are shown
# on every taxonomy overview page, this is not wanted
wt_media.manage_taxonomy:
  route_name: entity.taxonomy_vocabulary.overview_form
  route_parameters:
    taxonomy_vocabulary: media
  base_route: view.medialibrary
  title: Manage Categories

How can I prevent my custom tabs from appearing on the taxonomy overview pages?


texts: How to rewrite the ouput html of the image field for a node page?

texts:
I have an image field where people can upload an unlimited number of photos to a node. By default, drupal 7 outputs these images with html similar to the following:

This is fine, but for my application, I would like to be able to print a unique number to identify the image in the class or as an id - so, instead of field-item even, field-item-012 even, for example.  Should this be done in the template file or in template.php file?

Thanks!


texts:
I am looking a watermark module that have a selection watermark just like in the image.

Unfortunately the media watermark module is support drupal 7.

Does drupal have another module that have the same feature as media watermark?

PS: I am using drupal 6.


texts:
On a Centos 6.5 box, I'm having difficulty with drush dl, the following errors are presented:

$ drush dl profile2
exec(): Unable to fork [wget --version 2>&1] exec.inc:150                                                                            [warning]
exec(): Unable to fork [curl --version 2>&1] exec.inc:150                                                                            [warning]
exec(): Unable to fork [which curl 2>&1] exec.inc:150                                                                                [warning]
wget nor curl executables found.

Both curl and wget are installed on this box, both residing in /usr/bin.  Any ideas?


texts:
We are using Zen 7.x-5.x with responsive settings and I want to create a grid for some items. That is responsive and adaptive so first the grid is 3 items and then when the viewport gets narrower there is 2 or one.

How can I use Zen grids with Views is there an automatic way of specifying a n column(s) responsive grid out of views? Is there a connection or are there any specific classes I can use in my views?

Thanks!


texts: Cannot create custom config entity fails because ID is blank

texts:
I have created the following custom config entity. When I try to create a new one, I get the following error:

Drupal\Core\Entity\EntityMalformedException: The entity does not have an ID. in Drupal\Core\Config\Entity\ConfigEntityStorage->save() (line 248 of core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php).
Drupal\Core\Entity\Entity->save() (Line: 637)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 151)

My understanding is that the entity system will create an ID for this entity, but it doesn't seem to be working in my case. I'm struggling to figure out what I need to change to get this work:

<?php

namespace Drupal\example\Entity;

use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\example\Entity\ExampleConfigInterface;

/**
 * Defines the ExampleConfig entity.
 *
 * ExampleConfig config entities define a configuration for a specific
 * entity/bundle. Per entity settings are then saved as ExampleContent
 * entities.
 *
 * @ConfigEntityType(
 *   id = "example_config",
 *   label = @Translation("Example configuration"),
 *   fieldable = FALSE,
 *   handlers = {
 *     "list_builder" = "Drupal\example\ExampleConfigListBuilder",
 *     "form" = {
 *       "add" = "Drupal\example\Form\ExampleConfigForm",
 *       "edit" = "Drupal\example\Form\ExampleConfigForm",
 *       "delete" = "Drupal\example\Form\ExampleDeleteForm",
 *     }
 *   },
 *   config_prefix = "example",
 *   admin_permission = "administer site configuration",
 *   entity_keys = {
 *     "id" = "id",
 *     "example_entity_type" = "example_entity_type",
 *     "example_bundle" = "example_bundle",
 *   },
 *   links = {
 *     "edit-form" = "/admin/config/content/example/{example_config}",
 *     "delete-form" = "/admin/config/content/example/{example_config}/delete",
 *   }
 * )
 */
class ExampleConfig extends ConfigEntityBase implements ExampleConfigInterface {

  /**
   * The ID of the block.
   *
   * @var string
   */
  protected $id;

  protected $exampleEntityType;
  protected $exampleBundle;
  protected $exampleExpiry;
  protected $exampleDefaultStatus;

  /**
   * Get the bundle
   */
  public function getExampleBundle() {
    return $this->exampleBundle;
  }

  /**
   * Get the entity type.
   */
  public function getExampleEntityType() {
    return $this->exampleEntityType;
  }

  /**
   * Get the expiry time for this configuration.
   */
  public function getExampleExpiry() {
    if (!$this->exampleExpiry) {
      return example_expiry_default();
    }
    return $this->exampleExpiry;
  }

  /**
   * Get status for this configuration.
   */
  public function getExampleStatus() {
    return $this->exampleDefaultStatus;
  }

}

I have ended up prefixing all the custom properties to try to make sure I wasn't overriding something on accident. Even when the custom entity is blank, it still won't add.


texts: How do I download a specific version of a module?

texts:
The official documentation for Drupal Console says that the arguments for drupal module:download are the following.

drupal module:download [arguments] [options]

is there an argument or option to specify the dev/beta version of the module?


texts:
I'm trying to change the breadcrumb in Drupal to display in Danish through the template.php in my theme, but I cannot change it. I've flushed the cache.

This is what I've put in the template.php.

  function modeindeks_breadcrumb($variables) {
    $breadcrumb = $variables['breadcrumb'];

    if (!empty($breadcrumb)) {
      // Provide a navigational heading to give context for breadcrumb links to
      // screen-reader users. Make the heading invisible with .element-invisible.
      $output = '
' . t('Du er her') . '
';

      $output .= '
' . implode(' › ', $breadcrumb) . '
';
      return $output;
     }
    }


texts: FOUT with the @Font-your-face module and fonts.com causing Screen Flash

texts:
I am working on a site with fonts provided by fonts.com

We had an issue of FOUT(flash of unstyled text), which we managed to correct by using the following from fonts.com

<script type="text/javascript">
// first, create the object that contains
// configuration variables
MTIConfig = {};
// next, add a variable that will control
// whether or not FOUT will be prevented
MTIConfig.EnableCustomFOUTHandler = true // true = prevent FOUT
</script>

However it is creating a seperate issue that on every page load the screen flashes white.

I have searched for documentation regarding this class on fonts.com but cannot find how to alter which tag it chooses.

I was wondering if anyone else has had this problem and how you solved it.


texts: How do I disable modules via admin interface or via Drush?

texts:
In Drupal 7 it was possible to disable modules via admin interface or via Drush drush pm-disable. In Drupal 8 the checkboxes are greyed out in the admin interface and Drush is not able to disable them via pm-disable? How do I disable modules in Drupal 8 with Drush or via admin UI? Or do I need Drupal console for such tasks?

(Sorry for the confusion caused by using the word "programmatically" mistakenly, it was referring to the meaning of "via command line")


texts: How can I edit a custom field with Rule and VBO of a NOT published node?

texts:
I'm currently stuck in the creation of a custom rule.
I've created a content type "Avviso" with a publishing date field (start & end) and a custom field_stato with this values:

Not active
Active
Terminated
Archived

Now I would like to change the value of field_stato and publish all nodes with date_start < now < date_end. For that I've created a view with a VBO field, a Rule (triggered by the cron) and a component (of type rule) that do the job.

The problem is that the rule can see only node already published and -of course- cannot switch the node itself to "Published" state. With already published nodes the rule works fine.

Is there any restriction or permission with rules and unpublish content=?

(see images)


texts: How to store/manage/display data sets in Drupal without using the node/entity systems?

texts:
I need to store some straight forward data rows (similar to the JSON objects that can be stored in MongoDB), where all the data associated with one object is found on the same row and not scattered over several database tables.

What is the best approach to do this in Drupal?

Notes:

I am considering storing them on database (MySQL/Postgres or MongoDB). I have no data yet (I am at the project planning stage).
I'll be using some API code (server side - does not need to have anything to do with Drupal) and I will be creating/updating the data via JSON post requests from a c# application. I need Drupal only to display the data.


texts:
This is pretty straight forward. How do I print a link to the homepage as field in Views?

I have added a global text field with html code Home but this is just the path to the root & my website is installed in a subdomain.

Using D7 and latest Views module.


texts: How to make address1 field and zip code non required with Address Field module

texts:
I'm using Address Field module

I want to make it a required field but only the Country and City values. I want to leave the zip code and Address as optional. I don't find a way to configure it like this. Is it possible?

To provide more info, I am using Geocoder to fill a Geofield field. I want it to be able to geolocate with City and Country if only that are provided if also zip code and address are provided use them too.

EDIT: I forgot to mention that if I make the whole Address field non-required works as I want to, but I would like to make Country and City required, another way to look at the problem.


texts:
I can't get views tabs to work in D8, following the exact UI procedure that does work in D7.

To be more precise, in D8 at /mypage I see no tabs at all, and at /mypage/tab2 and /mypage/tab3 I do see tabs "tab2" and tab3" but no "MyDefaultTab".

In D7, I see all 3 tabs when viewing any of the 3 URLs.

The following procedure works to create a Views page with tabs in D7 on simplytest.me, but does not work for D8 beta 15:

Manage > Structure > Views > Add new view
View name = "Myview"; Show "Content" of type "all"; save and edit.
Add page display; name="MyPage"; path = "mypage"; menu = "Normal menu entry" with menutitle ="MyPage" and parent="" (its default value) and weight=0;
Add page display; name="MyDefaultTab"; path="mypage/defaulttab"; menu = "Default menu tab" with menutitle ="DefaultTab" and parent menu item ="Already exists";
Add page display; name="tab2"; path="mypage/tab2"; menu="Menu tab" with menutitle="Tab2" and parent ="" (its default value) and weight=0.
Add page display; name="tab3"; path="mypage/tab3"; menu="Menu tab" with menutitle="Tab3" and parent ="" (its default value) and weight=0.

Is this a D8 bug, or am I missing something?

Things I have tried (all made no difference, good or bad):

Selecting "MyPage" (the non default but sensible seeming value) in the "parent" drop down for tab2 and tab3 (there are more menu options available in D8 than D7).
Selecting "Normal menu item" instead of "Already exists" for the parent menu item of the default tab.
Configuration > Performance > Clear All Caches

Any suggestions?


texts:
I'am trying to export menu items but the generated yaml files does not contains any reference to this elements. All menu files look like this:

uuid: 12....04
langcode: en
status: true
dependencies: {  }
id: how-works
label: 'How it works'
description: 'Menu description'
locked: false

Is there a way to export/import menu elements?


texts:
I admit; I am not a fan of writing length SQL queries and I am a huge fan of Views. Many times when I need a list of nodes (such as processing nodes in a cron task), I have created a View and then used views_get_view_result to get my items (and process them).
In D7 I think views_get_view_result returned the NID and whatever other fields I had added to my View. In D8, it seems to be also including the fully loaded node object. Although this is very handy, as in most cases I am likely going to need the node object and this means I do not need to load it in my code; but, is this very memory efficient? Is passing hundreds or thousands of fully loaded node objects not going to cause memory issues?
Is there a way to only pass NIDs and then let me loop through them and do a Node::load()?


texts: Importing data into specific fields from CSV - into pre-existing nodes?

texts: I've used the Feeds module before to import nodes and users. I need to import data into new fields on pre-existing nodes - is that possible?


texts:
In the code below, the first alert() fires, but the second one never fires when I click the textfield assigned with the 'clear' class.

Does anyone have a clue why this happens?

(function ($){

   alert('TEST 1');
   var clearMePrevious = '';

   // Clear input on focus.
   (function ($)('.clear').focus(function() {
     alert('TEST 2');
     /*
      if ($(this).val() == $(this).attr('title')) {
        clearMePrevious = $(this).val();
        $(this).val('');
      }
      */
    }(jQuery));

}(jQuery));

The problem is just in the inner code, as $document.ready() fires the TEST 1 alert.

I have tried different variations of (function ($){}); and function (jQuery){});.


texts: Can Display Suite be used for "Show: Fields" as well as "Show: Content" to be able to rewrite field output?

texts:
I need to be able to adjust field output in view results but also want to make use of Display Suite for layout.

However, it would appear that Display Suite is only available for "Show: Content" and not "Show: Fields" View Display Format and therefore the facility to rewrite output is not available.

Definition and comparison of "Show: Content" vs "Show: Fields"

In Views, what is the difference between "Show Fields" and "Show Content" under Format?


texts: API error: "The 'administer nodes' permission is required."

texts:
When sending a POST  to Drupal 8's JSON:API (to create an entity) that references another content piece (linked by a UUID), I get the error:
"The current user is not allowed to POST the selected field (uid). The 'administer nodes' permission is required."
or in more detail:
"errors": [
        {
            "title": "Forbidden",
            "status": "403",
            "detail": "The current user is not allowed to POST the selected field (uid). The 'administer nodes' permission is required.",
...

the original JSON in the POST request is:
{
  "data": {
    "type": "node--itinerary",
    "attributes": {
      "title": "Article by admin",
      "body": {
        "value": "Custom value",
        "format": "plain_text"
      }
    },
    "relationships": {
      "uid": {
        "value": "a05c9063-d594-4e5e-8b1f-f0b6b9f0d77e"
        }
    }
  }
}

I've tried researching this issue but it's not clear what the permission is that needs to be set (there is no: "administer nodes" in permissions) and it's not clear if this level of access is too much. Does anyone have any further information/ideas?


texts: How to get acces to XML tag attributes via XPath parser settings?

texts:
I need to parse XML attributes via Feeds Importer XPath parser

exitsting XML tag structure is:

<MunicipalUnion Id="2a1c7bdb-05ea-492f-9e1c-b3999f79dcbc" Name="Moscow" TypeMU="city"/>

If i write @Id, @Name, @TypeMU, result is:


texts:
I am getting a PDO error which seems related to the Mass Contact module. I installed, played with and then disabled the Mass Contact module. Now when I run cron I get the error:

  PDOException: SQLSTATE[42S02]: Base table or view not found: 1146
  Table 'drupal.field_data_field_mass_contact_category' doesn't exist:
  SELECT field_data_field_mass_contact_category0.entity_type AS
  entity_type, field_data_field_mass_contact_category0.entity_id AS
  entity_id, field_data_field_mass_contact_category0.revision_id AS
  revision_id, field_data_field_mass_contact_category0.bundle AS bundle
  FROM {field_data_field_mass_contact_category}
  field_data_field_mass_contact_category0 WHERE
  (field_data_field_mass_contact_category0.deleted =
  :db_condition_placeholder_0) AND
  (field_data_field_mass_contact_category0.bundle =
  :db_condition_placeholder_1) LIMIT 10 OFFSET 0; Array (
  [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] =>
  mass_contact ) in field_sql_storage_field_storage_query() (line 585 of
  /var/www/modules/field/modules/field_sql_storage/field_sql_storage.module)

If I try to uninstall Mass Contact I get the error:

  PDOException: SQLSTATE[42S02]: Base table or view not found: 1146
  Table 'drupal.field_data_field_mass_contact_category' doesn't exist:
  UPDATE {field_data_field_mass_contact_category} SET
  deleted=:db_update_placeholder_0; Array ( [:db_update_placeholder_0]
  => 1 ) in field_sql_storage_field_storage_delete_field() (line 312 of /var/www/modules/field/modules/field_sql_storage/field_sql_storage.module).

The table 'field_data_field_mass_contact_category' does not exist. It is not even created if I enable the Mass Contact module and create a category.

I have tried clearing all cache tables (using phpmyadmin) both with the Mass Contact module enabled and disabled.

I am using Drupal 7.32 on ubuntu localhost.

I have no idea how to proceed. I have found no relevent solution searching the questions here with "PDOException: SQLSTATE[42S02]: Base table or view not found". Any help/advice about how to proceed to track this problem down appreciated.


texts: Display all dates for a multi-day "event"

texts:
I have an "event" content type that can have multiple dates or repeating dates. Up until last week the node view of a repeating event would display all the dates for the event.

  Repeats every week every Friday until Fri Apr 27 2018.
  Friday, April 6, 2018 - 10:00am to 11:00am
  Friday, April 13, 2018 - 10:00am to 11:00am
  Friday, April 20, 2018 - 10:00am to 11:00am
  Friday, April 27, 2018 - 10:00am to 11:00am

Now it only displays the first date.

  Repeats every week every Friday until Fri Apr 27 2018.
  Friday, April 6, 2018 - 10:00am to 11:00am

I don't know what change I made that caused this. I checked the date field settings and the field display settings against a recent backup, and everything is the same.

Do you have any idea?

EDIT: It's not a display issue, it's a data issue. Via node_load() I can see that only the first data is written to the database:

'field_reserved_time' => array(
    'und' => array(
      array(
        'value' => '2018-04-05 19:30:00',
        'value2' => '2018-04-05 20:30:00',
        'rrule' => 'RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TH;UNTIL=20180427T065959Z;WKST=SU',
        'timezone' => 'America/Los_Angeles',
        'timezone_db' => 'UTC',
        'date_type' => 'datetime',
      ),
    ),
  ),

While previously it would write all dates to the db:

'field_reserved_time' => array(
    'und' => array(
      array(
        'value' => '2018-04-06 17:00:00',
        'value2' => '2018-04-06 18:00:00',
        'rrule' => 'RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=FR;UNTIL=20180428T065959Z;WKST=SU',
        'timezone' => 'America/Los_Angeles',
        'timezone_db' => 'UTC',
        'date_type' => 'datetime',
      ),
      array(
        'value' => '2018-04-13 17:00:00',
        'value2' => '2018-04-13 18:00:00',
        'rrule' => 'RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=FR;UNTIL=20180428T065959Z;WKST=SU',
        'timezone' => 'America/Los_Angeles',
        'timezone_db' => 'UTC',
        'date_type' => 'datetime',
      ),
      array(
        'value' => '2018-04-20 17:00:00',
        'value2' => '2018-04-20 18:00:00',
        'rrule' => 'RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=FR;UNTIL=20180428T065959Z;WKST=SU',
        'timezone' => 'America/Los_Angeles',
        'timezone_db' => 'UTC',
        'date_type' => 'datetime',
      ),
      array(
        'value' => '2018-04-27 17:00:00',
        'value2' => '2018-04-27 18:00:00',
        'rrule' => 'RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=FR;UNTIL=20180428T065959Z;WKST=SU',
        'timezone' => 'America/Los_Angeles',
        'timezone_db' => 'UTC',
        'date_type' => 'datetime',
      ),
    ),
  ),


texts: Installed Views Module but It did not appeared in Structure

texts:
I installed a fresh Drupal 7.22 on my localhost and installed Ctools and Views modules.

When i go to Structure i dint find Views link

I also cleared all cache but still same problem.

This is not my first Drupal experience, I created many views.

Here are the screen shots.


texts: Why URL-alias of taxonomy doesn't have the correct language, is this a bug?

texts:
I have a multisite (drupal 7) with Pathauto and my vocabulary is set to 'Translate. Different terms will be allowed for each language and they can be translated.'

I add a taxonomy term in English with pathauto enabled but when I check the URL-alias for this taxonomy it says:

Is this normal? I want it to be English too. Pathauto does this correct for a node but not for a taxonomy term.

[edit] When I create the alias manually the problem remains. So the problem isn't PathAuto.


texts:
I have a module I wrote that is used on a production site.  I had to make some changes and need to update the module.

Where do I begin to learn to do this?


texts:
I am trying to develop a custom module; so far it works as it should. The only problem is I can't seem to get the MAC address to remain unchanged on update. It keeps getting the device ID number instead of the MAC field. How do I avoid the MAC address is changed?

function device_delete_request($uid = null, $macaddress, $device_id = null) {
  db_update('argon_user_stuff')
    ->fields(array(
      'id' => $device_id,
      'uid' => $uid,
      'macaddress' => $macaddress,
      'deletedmacaddress' => $macaddress,
      'updated' => REQUEST_TIME,
      'deleted' => REQUEST_TIME,
      'active' => 0
    ))
    ->condition('uid', $uid, '=')
    ->condition('id', $device_id, '=')
    ->execute();

    // Set the message and return to the user's profile page
    drupal_set_message('Device deleted');
    return drupal_goto("user/{$uid}/devices");

}


texts: Add fields to image upload option in CKEditor

texts:
I make SVGs using LaTeX and would like to upload both the image and its LaTeX source code when I attach an imagine via CKEditor. I don't want the code to be displayed, just stored with the image so that I can change it later if I need to, or use it as a reference for making more images.

There are already some default fields for images in the upload widget, such as alt-text and caption, so this seems possible. I just want another field called "source" where I can dump the LaTeX.


texts:
As a total newbie in Drupal I asked myself where do I include a css file? (Using Drupal 6)

I wrote a web application with javascript, php and mysql and now I'm trying my first steps in migrating this application to Drupal. I already found out on Stackoverflow How to include css and javascript files.
Since i know now which function to use to include my css file, I don't know where.
Do I have to simply create a new module (named "mymodule" like in the example from stackoverflow)?
Or is the css file only applied to the module "mymodule"? If so, how can I apply it to a page filled with plain HTML?


texts: Webform Multiple Value Fieldset - Custom Email Values Print

texts:
I have build a webform and installed this module WFM so user can insert multiple values on a certain fieldset.

Now i want to create a custom email template to print these values.
For Simple text fields i write for example :

 [submission:values:FIELD-MACHINENAME:nolabel]

What must i write??? to retrieve to retrieve each value of each fieldset :

For example the set of values for 1st fieldset is:

Fieldset-Name_FieldkeyName-1  Fieldset-Name_FieldkeySurname-1  Fieldset-Name_FieldkeyPhone-1

When user click for add more

Fieldset-Name_FieldkeyName-2  Fieldset-Name_FieldkeySurname-2  Fieldset-Name_FieldkeyPhone-2

Fieldset-Name_FieldkeyName-3  Fieldset-Name_FieldkeySurname-3  Fieldset-Name_FieldkeyPhone-3

..............................  and so on

How can i print these individually on custom email template?????


texts:
For some reason, my EntityQuery is returning 60 articles.  There are actually 63 of them.  I am certain about this.

Here are some questions I have:

I don't think revisions are enabled for my content types, but how do I check? And, how do I do this programmatically? I'm not sure if my EntityQuery is returning nids or vids...
Why would EntityQuery be unable to find an article? It seems like it can't find it, even if I just search for nodes containing part of its title. It returns 0 results.

Here's what I've tried:

I did a loop and loaded the nodes from the nids, printed out the titles, and I copy pasted the node titles (filtered on articles) from the content list, did a diff with the alphabetized results to find the three articles which EntityQuery doesn't believe to exist.  They are all normal seeming articles, which can be viewed/edited.

I started debugging into the core EntityQuery files, but I'm afraid at this rate it's going to take me a while before I understand what's going on.  Does anyone know why an EntityQuery might not find certain nodes, or even have an idea where I should be looking in the core files, or what I might be expecting to look for in the DB tables?

I'm using MySQL 5.7, in case that's relevant at all.

EDIT: Someone asked for the code, I am doing an EntityQuery for all articles, yet I don't get all of them:

$query = \Drupal::entityQuery('node')
  ->condition('type', 'article');
$entity_ids = $query->execute();

foreach($entity_ids as $id){
  echo $id->getTitle() . "\n";
  // Do I do Drupal entity node load, or do I load via revision ID?
  // Here I would like to load the node and then do stuff with it...
}


texts: Unique violation when trying to create a new Field Collection using Rules

texts:
When I try to create a new field collection for a node I just saved, I encounter following error:

  PDOException: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate
  key value violates unique constraint "node_pkey" DETAIL: Key
  (nid)=(47) already exists.:

However, if I try to create a node this way, it works fine, so I assume it's a bug in Field collection.

I don't know it it matters, but I'm using PostgreSQL 9.3 as my DB. Also, this issue might be related to the issue about Field Collection Item Duplicate with Rules, but I'm not sure (there is not DB level error mentioned there).

Example of failing rule:

{ "rules_generate_field_collection_items" : {
    "LABEL" : "Generate field collection items",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_insert--smlouva" : { "bundle" : "smlouva" } },
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "field_collection_item",
            "param_field_name" : "field_dodatky_ke_smlouve_fc",
            "param_host_entity" : [ "node" ]
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      }
    ]
  }
}

For example, this works fine:

{ "rules_generate_nodes" : {
    "LABEL" : "Generate nodes",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_insert--smlouva" : { "bundle" : "smlouva" } },
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "node",
            "param_type" : "mesto",
            "param_title" : [ "node:title" ],
            "param_author" : [ "site:current-user" ]
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      }
    ]
  }
}


texts: Displaying another entity's form on a node

texts:
I am trying to embed the edit form for a flag on my node (the full page view mode).
After some struggle, I finally figured out how to get the flagging form.  But once I have the form, how do I actually get it to display on the page?
function MYMODULE_node_view(array &$build, NodeInterface $node, EntityViewDisplayInterface $display, $view_mode) {
  if ($node->getType() == 'MY_CONTENT_TYPE') {
    $flag = \Drupal::service('flag')->getFlagById('MY_FLAG_ID');
    $flagging_entity = \Drupal::service('flag')->getFlagging($flag, $node);
    $form = \Drupal::service('entity.manager')
      ->getFormObject('flagging', 'edit')
      ->setEntity($flagging_entity);
    $form_obtained = \Drupal::formBuilder()->getForm($form);
    // How do I actually show the form on the node?

I looked at this question on rendering forms (which says use the formBuilder service, which I am already using). I assume I need to put the form in a render array but the documentation is not clear about how to do that.


texts:
I'm using Drupal 8.6.14 (going to upgrade soon) and I am trying to create a cookie consent page that actually works!

I've used many different modules like EU Cookie Compliance, GDPR Compliance and several others, but all of them fail to block Google Analytics cookies.

I even used a couple of patches on Google Analytics that I found in the community in order to support EU Cookie Compliance module, but all of them fail.

To be exact, EU Cookie Compliance seems to load the cookies as normal, then deleting them as the dialog of consent appears and then loading them all again once I pick any option.

All the other solutions seem not to work at all (I get the cookies any time the page loads). BTW, all the solutions I've found are for <8 versions.

Any idea how I can get this done? Am I missing something?


texts: How to change date format to custom in Views? (drupal 6, views2)

texts:
I have a view that includes a CCK date/time field. It automatically displays the date like this if I choose Long as the format:

Tuesday, April 17, 2012 - 13:30

I need it to display in 12-hour time, not 24-hour, but the view field config doesn't allow me to enter a custom format for my date (for the label, yes - the actual value, no). How can I override the date formatting for just this one view?

EDIT

Never mind; I found a way to do it here.


texts: How can you make a second contextual filter completely optional

texts:
In views, is it possible to have two contextual filters, making one mandatory (return no results if not supplied), and the other optional? I'm using a php filter to get the group id for the og_group_ref field, and it works well, but then I add another filter on another field, and I need to be able to check only on certain pages (that provide the param in the url), or else, just return all record.  I tried a conditional for the second filter, like

    if(some test){
      return field_value;
   }
    else{
      return 'all';
   }

That didn't help either.


texts: how can have this url car1?category=blue car?category=red car2?category=blue

texts:
for drupal 6.x
I have a vocabulary with terms
car1
car2

and a vocabulary with terms
red
blue
yellow

how can to do this
2 menu
1) car1 | car2     (this really how a select)

2) Allcolor |  red  |  blue  |  yellow

3) here the results

when I click on car1 I have a page with all the car1's color nodes (and the Allcolor menu active)
url think so must to be:
/car1

if I click on red I have the result of car1 red nodes
/car1?category=red
if select blue
/car1?category=blue

when am on red under car1 and click on car2 I have the red car2 results
/car2?category=red

not sure if the url is so, but which is solution for to do this
functionality?

I know that is simple with only one vocabulary type this
car1
  red
  blue
  yellow
car2
  red
  blue
  yellow

but I must to do with distinct vocabulary; the terms really are more


texts: Changes to Input Formats not saving: Default instance field is required

texts:
When trying to make any changes to any text format, when I click "Save" Drupal returns an error message: "Default instance field is required." and the changes are not saved. Screenshot: http://awesomescreenshot.com/0ff38my7f7 (Drupal version 7.30.)

Can anyone suggest what could be causing this?


texts: Blog posts are being listed under content

texts:
I know nothing about Drupal, trying to help a friend out.

Right now blog posts are being listed under /content [site.com/content/blog-post-title] instead of /blog.

I'm trying to figure out where to look to figure out why.


texts: How to add flag relationship in search index views?

texts:
Is there anyway to link search index views to flag module?
I want to use UID in relationship of views.


texts: How to print taxonomy term name with published node count and with a custom link?

texts:
How can I print taxonomy name with published node count with a custom link?

eg: Taxonomy term-a (23) Taxonomy term-b (10) Taxonomy term-c (55)

I need to link each of them to a separate page.

I found this below code to print taxonomy term with count. but now how to make to print specific taxonomy term with it's node count? so that I can link it to a page later, so if I repeat the same code with different term ids to have multiple terms with its count.

    <?php
$vid = 23;  // Set the vid to the vocabulary id of the vocabulary you wish to list the terms from
$parent = 130;

$terms = taxonomy_get_tree($vid, $parent, -1, 1);
foreach ( $terms as $term ) {
  $count = db_result(db_query("SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} t ON n.nid = t.nid WHERE t.tid = %d AND n.status = %d", $term->tid, 1));
  {
    print '
' . l($term->name, "taxonomy/term/$term->tid") . " ($count)"  . '
';
  }
}
?>

Can someone please help me?

__HAD TO ANSWER HERE AS I CAN'T AT THE BOTTOM__

This is it!!!

Took a while to write this code... :(

<?php
$tid = 100;
$term = taxonomy_get_term($tid);
$name = $term->name;
$result = db_result(db_query("SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} t ON n.nid = t.nid WHERE t.tid = %d AND n.status = %d", $term->tid, 1));
print '
' . $name. " ($result)" . '
';
?>

Change: 100 at the second line of above code to your specific taxonomy id, that's it and repeat the same for different tid.

And make sure to change the link at the bottom from (http://example.com/) to your (custom link).

Thanks a lot to all, let me know if this code can be fine tuned further...


texts:
Context: using the registration module, I am trying to customize the entity registration form depending on the user:

show a 'please login in order to register' to anonymous visitors
show a 'edit registration' link to already registered users
show the registration form, as well as an info message (xx seats left / fully booked butwait list is still open), to not registered yet users.

Current status: I managed to customize the field display using a field template in my custom theme. Unfortunately the field is not displayed anymore when the event is fully booked (without a 'fully booked' message). I changed that by implementing a custom field formatter based on the registration 'form' field formatter.

Problem: In order to have the thing easier to maintain, it sounds like a better idea to have the theming done directly in the module (named 'zss'). Although it is probably easy meat for drupalers, I do not manage to do that so far. The current code reads like:

function zss_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();

  // we know we should only have a single item
  if (isset($items[0]['registration_type']) && !empty($items[0]['registration_type'])) {
    $reg_type = registration_type_load($items[0]['registration_type']);
    $settings = $display['settings'];
    $label = !empty($settings['label']) ? $settings['label'] : $reg_type->label;

    if ($display['type'] == 'zss_registration_default') {
      // Enable registration link if accessible.
      list($entity_id) = entity_extract_ids($entity_type, $entity);
      if (registration_register_page_access($entity_type, $entity)) { // && registration_status($entity_type, $entity_id)
        $registration = entity_get_controller('registration')->create(array(
          'entity_type' => $entity_type,
          'entity_id' => $entity_id,
          'type' => $reg_type->name,
        ));
        $element[0] = drupal_get_form('registration_form', $registration);
//         I tried the following to theme the field:
//         $element[0] = theme('zss_theme_zss_registration_default', drupal_get_form('registration_form', $registration));
      }
    }
  }
  return $element;
}

/**
 * Implements hook_theme().
 */
function zss_theme() {
  return array(
    // The theme function that our formatter uses:
    'zss_theme_zss_registration_default' => array(
      // Don't forget that all Drupal 7 theme functions have only one argument,
      // so you declare what variables get passed within that argument instead.
      // See http://drupal.org/node/224333#theme_changes
      'variables' => array('element' => NULL),
    ),
  );
}

/**
 * Theme function for 'zss_theme_zss_registration_default' field formatter.
 */
function zss_theme_zss_registration_default($element) {
  // Here I would like to have a condition, depending for instance on the user id
  return $element;
}

Thank you in advance for your help.


texts: "Can't migrate source field body of type text_with_summary configured with plain text processing."

texts:
I am trying to migrate a Drupal 7 site to Drupal 8, but I get the following error message.

Can't migrate source field body of type text_with_summary configured with plain text processing. https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text

I read the linked documentation page and changed the body field in every content type to filtered, but the error persists.
How can I resolve this issue?


texts:
I have the theme Bootstrap CDN 3.3.6 installed on my site and I use the appearance "Journal". How not to use the CDN maintaining the appearance "Journal" ? Thank you

I download on Bootstrap http://getbootstrap.com/getting-started/#download and I copy the folder in my sub-theme, as you can see on the screenshot.
I copy the file overrides-journal.min.css to bootstrap theme of css file my subtheme.
I added a few lines in my file bootstrap_subtheme_front_office.info, see the catch.
I disabled CDN in subtheme /admin/appearance/settings/bootstrap_subtheme_front_office
I deleted the cache.

If I erases the line stylesheets[all][] = css/overrides-journal.min.css the theme works correctly but I want to show the appearance of the theme "Journal".

If I add the line stylesheets[all][] = css/overrides-journal.min.css the theme "Journal" is not applied.


texts: How a anonymous user can view profile of authenticated user

texts:
How to see a profile of registered user by a anonymous user.

exampel : someuser2

when an administrator clicks any username or someuser2
it displays in this format in url on browser

http://mydomain/users/someuser1

When an anonymous user paste this link on browser,
the profile doesn't appear.

Is there any permissions to be ruled out ?, to display user profile.


texts:
For some reason, when testing my module (displays a form), the module seems to "disable" itself. I reload the page, and the block isn't displayed anymore.
If I go in the "Module" menu, my module is there, but unchecked.

I unfortunately do not have a pattern to reproduce what makes this happen. The website is local online for testing purpose, so no-one can tamper with it.

What could be causing this problem, and how can I find the cause?

EDIT : Here's the module.info :

name = "Module title"
description = "Module description"
package = Companyname
core = 7.x
version = 0.0.1
configure = admin/config/system/mymodule


texts: Roles are not correct while getting it in hook_user

texts:
I have added a new role called pre-auth i.e. if a user is registered and has not clicked the confirmation link(using LoginToboggan module) from the mail and the other is authenticated role its the normal authenticated role. I have a hook_user to check the role but it gives me as "authenticated user " always but in admin/user/user/ it shows the role as  "pre-auth"

function mynewmod_user($op, &$edit, &$account, $category = NULL){
  switch ($op){
  case 'insert':
  case 'after_update':
    $user_details = user_load($account->uid);
    drupal_set_message('<pre>'. print_r($user_details->roles, true) .'</pre>');
}

Can any one tell me how can I get the exact role.


texts: Display selected fields from referenced node rather than just referenced node title

texts:
I've searched for an answer to this, I can't find it for the life of me.

I want to in a node display additional selected fields from referenced nodes, not just the title field of the referenced node.

Like follows:

CONTENT TYPE A, NODE A1
Title: Employee 134
First Name: John
Last Name: Smith
Content Type B Reference: Job 3

CONTENT TYPE B, NODE B1
Title: Job 3
Job: Carpenter
Description: Constructs tables and chairs.
Image: carpenter.jpg

I can currently only display for A1:

Employee 134
John
Smith
Job 3

I want it to display:

John Smith
Carpenter
[carpenter.jpg]


texts: Bulk update pages that use old URL alias by content type

texts:
We have a content type, Basic Page that recently had the URL pattern changed from www.example.com/page/page-title to www.example.com/page-title. Under the Pathauto settings found at /admin/config/search/path/update_bulk there are options to Select the types of paths for which to generate URL aliases which allows for selecting different entities such as Content. Additionally there is Select which URL aliases to generate where we want Update the URL alias for paths having an old URL alias as the choice.

We don't want to update all Content entities, but rather we want to update by content type.

How would we update URL alias after changing the path pattern by content type either programmatically or through an existing module?

The goal is to be able to do update all Basic Pages URL alias, but not others.


texts: Programmatically show message to only specific user

texts: I made a custom module where I dynamically fetch some usernames from the database. Now I want to send some messages or data to those users' dashboard. I mean that when the selected user is logged in to the website he/she can view the message from their dashboard or profile page. How can I do this programmatically?


texts: Custom text output for entity reference fields

texts:
In my content type I have an entity reference field. With this field editors can create internal links effordlessly with the autocomplete function.

What I want to achieve is that editors can now customize the text to output the referenced node. E.g. The editor creates a reference to a node and in a different field creates the "title" of the reference, she has just created. Thus references can have custom display titles.

I have tried the token formatters module (http://drupal.org/project/token_formatters) but to no avail.

In my particular case I have a field reference_text and have set the format of my entity reference field to "Tokenized text". In the "Text to output" field I have tried the following:
1) [node:reference_text]
2) [current-page:reference_text]

With 1) an empty field is displayed. With 2) I get an error message: Text output uses the following invalid tokes: [current-page:reference_text]

Not sure what else to try. Any help would be greatly appreciated. Big thanks in advance.


texts: Example of writing Latitude Longitude to a Geofield?

texts: I need to write a lat/lon value to a Geofield and I can't figure out how to set the field. I would prefer to do this using EntityMetadataWrapper.


texts: Convert timezone value from seconds to W3C hour format

texts:
Doing an API integration that requires timezones to be handed off in W3C format, while Drupal opts to store timezones in seconds.

Wondering what the clean way to do this is, rather than stripping the +/- sign, dividing by 3600 and adding it back on. There has to be a date transformation right?

FYI... W3C looks like this: -08:00 and Drupal looks like this: -28800

Trying to avoid this code...

// $val = '-28800';
$sec = substr($val, 1);
$hours = intval(intval($sec) / 3600);
$minutes = intval(($sec / 60) % 60);
$w3cTZ = substr($val, 0, 1) .
  str_pad($hours, 2, "0", STR_PAD_LEFT) .":".
  str_pad($minutes, 2, "0", STR_PAD_LEFT);


texts: Include OR Group With Exposed Filters in View

texts:
I have a view where I need to include an OR group for example (a + b) OR (C) as well as using Exposed Filters that will apply to both groups, giving something like (Ex1 + Ex2 + ((a + b) or c))). Is there any way I can make the exposed filters apply to both groups at the same time?

I thought it may be possible using nested or sub groups but I know it is not possible to create nested or sub groups in filters through the UI.


texts: How do I allow modules to provide their own view?

texts: In Drupal 7, there is hook_views_default_views() which allows modules to provide their own views. What's the equivalent for Drupal 8?


texts: How do I unpromoted existing node when new node is promoted to front page (Programatically)?

texts:
In Drupal 8 I want only one node at a time to be promoted to front page. If user promoted new node the existed should un-promoted automatically.

Can we implement this with events in Drupal 8?


texts: Customize autocomplete field to show children terms depending on another field

texts:
I have a taxonomy with 2 levels

City1
-Park1
-Park2
-Park3
City2
-Park4
-Park5
-Park6

In my form, I created a field that links to this taxonomy with an autocomplete widget. I also have a second field where the user chooses the city.

I would like to dynamically change the autocomplete value depending on the selected city. Which means if the user selects City1, the autocomplete will only filter through the values under City1.

After checking the form I've found that the widget entity_autocomplete have an attribute #selection_handler. Will it be possible to change this handler and somehow send the value of the selected city?

I think there should be an easier approach. Creating a custom autocomplete field based on a textfield doesn't seem like a good solution since it will not have (or I will need to do it manually) all the error handling and entity links.

Any suggestions ?


texts:
In hook_preprocess_menu(), I want to add custom classes to the <li> tag.
I tried the following lines of code, one at a time.

$item['attributes']->addClass('section');
$item['attributes']->setAttribute('class', array('section'));
$item['attributes']->setAttribute('class', 'section');

In any case, this is the HTML markup I get.
<li class="Array class">

How do I add the desired classes?


texts: A rule that updates the same field of two different content types nodes (related by node title)

texts:
I'm trying to find the way to do this with a rule:

I have 2 different content types. Profile and Reminders.
One boolean field is shared between them.

Every time a new Profile node is created, the default value of the boolean field is on.

Note: When creating a new reminder node, the name of the Title field will be the same of the Profile node Title.
Every time a new reminder node is created, the default value of the boolean field is on.

So, we have... (example)

Node type: Profile
title: Somename
Boolean: Active

Node type: Reminder
title: Somename
Boolean: Active

What i want to do is a rule that behaves like this
When updating the value of the boolean field of the profile node "Somename",
then update the same boolean field of the reminder node type node

Is that possible?


texts: How to include IP address Token with Rules?

texts:
I would like to track IP address and User Agent when Rules sends out a email. How can I include the [current-user:ip-address] token and %server[HTTP_USER_AGENT] in „Send email“ rule?

Unfortunately Rules (7.x-2.10) ignores both tokens.

IP Address: [current-user:ip-address]
User-Agent: %server[HTTP_USER_AGENT]

I’ve tried to create a rules Replacement tokens, however I am not able to create a new entity with Data selector site:current-user:ip-address
How can I create a Replacement tokens to show the current-user ip address?


texts: Drupal_add_js is not working inside hook submit

texts:
I have alter and hook submit for webform. I would like to pop a modal if form is successfully submitted. But drupal_add_js seemed to be not working inside the hook submit.

function myModule_form_alter(&$form, &$form_state, $form_id) {

    if($form_id == 'webform_client_form_9') {
        $form['#submit'][] = 'myForm_submit';
    }

}

function myForm_submit($form, &$form_state) {
    drupal_add_js(drupal_get_path('module', 'myModule') . '/misc/custom.js');
}


texts: How to solve limitations of 32-bit PHP in drupal 8

texts:
I am unable to complete the setup of Drupal 8. When I get to the third step then the error below will be displayed stating:

  "You are running on a system where PHP is compiled or limited to using
  32-bit integers. This will limit the range of dates and timestamps to
  the years 1901-2038. Read about the limitations of 32-bit PHP."

I am using a 32-bit windows 7 system. How can I resolve this issue?


texts: How do I update Drupal 7 to Drupal 7 DEV via Drush command line?

texts:
I have an old drupal 7 installation and I would like to update this via drush. Usually I download the drupal 7 dev version through the website using wget and untar it into the public_html directory and overwrite everything.

I know i can update drupal modules via "drush dl " but not sure how to do it for core easily using drush.


texts: Is there a way to display some content fields in a separate block?

texts:
I would like to display some content fields in a separate block so that I can manage the position of these like other blocks and also put them near to other blocks such as the search widget.

I am using display suite for laying out the content but don't think that this will serve my requirement to position some content fields further away from the the main content. One specific example I have is displaying the content's taxonomy fields below the search widget (which is in a block).


texts: Using Rules to compare cart and commerce credits

texts:
I've a site where transactions are based purely on credits. No actual money is exchanged. In such a case, I want to restrict users from adding products to cart if they do not have credits to do so.

In steps of how this should be accomplished, here is the sequence of events which I think should work :

Whenever somebody tries to add a product :

Use Rule "Before adding    product to cart"
I need to get the valueof the following :

Get user credits
Get sum of current product + cart value

Check for condition if credits is greater than product + cart.
If true, add product to cart else Display "Not enough credits".

The alternative approach to this could be disable add to cart button if there aren't enough credits.

Any help in setting up the rules for this scenario will be appreciated.


texts: Update only existing fields when source has content

texts:
When migrating into a pre-existing node, I know that I can specify which fields to update using the overwrite_properties. It looks like if the destination field is included in overwrite_properties and it already has content, that content will be removed, whether the source has any content for that field or not.

I had assumed that if I used the skip_on_empty plugin when importing (with method: process since I still want to migrate the other fields), it wouldn't change the destination field if the source is empty, but it looks like regardless of whether the source field is empty or not, all fields in the overwrite_properties array will automatically be cleared out.

What I would like to do is preserve the preexisting content in that field by default and only overwrite it if the source has content for that field.

Is that possible?


texts: Submit form and disable submission button

texts:
I want to disable the submit button after it is clicked to prevent multiple submissions. I have:

$form['show'] = [
'#type' => 'submit',
    '#value' => $textforsubmitbutton,
    '#name' => 'submit',
    '#attributes' => array("onclick" => "javascript: this.disabled = true;"
    ),
];

but this disabled the button completely. Using "onsubmit" in place of "onclick" doesn't change anything on the button. So maybe I need something like:

    '#attributes' => array("onclick" => "javascript: this.submit; this.disabled = true;"
    ),

How do i fix this?


texts: Getting a 403 error in REST & 8.2.3 has no permission set for REST for GET of content

texts:
Enable modules (including REST UI):

Enable the Content in REST resources:

Give permissions on /admin/people/permissions#module-rest ??:

Request returns 403 Forbidden error:

Reference:
Getting a 403 error in REST


texts: Services 3.0 Json string reveived with underscores

texts: I am using D7 services 3.0 and im sending data from an app. I use the json.stringify function before sending the data to my endpoint. However some characters are being replaced by underscores. For instance test@gmail.com becomes test@gmail_com. Any ideas?


texts:
I'm trying to understand how I can have the whole list of the CSS, JavaScript,  and the others files declared with the libraries method (or added in any right way to Drupal).

Earth would be a better place with a function like get_all_assets().

We are planning to create a less files aggregator and compiler ...


texts: How do you edit content of a Drupal\Core\Render\Markup instance via a preprocess function in Drupal 8?

texts:
From doing some experimentation, the only way I've been able to find to get the string property out of an instance of Drupal\Core\Render\Markup is to use the __toString() method:

$variables['fields']['title']->content->__toString();

But I'm guessing those initial underscores indicate that this is a private function, not to be used on the outside. Is there some better method to get at the content? My ultimate goal is modifying that content in some way.


texts:
We've used Webform to create a form, which users are supposed to fill and submit.
A part of this form contains tables, with cells, that are supposed to be calculated to a total for each column in those tables. However, the one who created the form, used text-fields for the cells and "Computed Twig" for the "sum cell". This has created quite the headache.
If for some reason a user writes anything other than a number say 100k/100' instead of 100000, then presses the button to "save draft" - the form crashes, with the following:

Warning: A non-numeric value encountered in _TwigTemplate

drilling down, it references the following:

Drupal\Core\Template\TwigEnvironment->renderInline('{#
inline_template_start #}{{ data.f1a + data.f1b + data.f1c + data.f1d
}}', Array)

The PROBLEM though, is that this is now saved and if the user tries to open their form to continue their work, it crashes. If an administrator tries to view their form, it crashes.
So my question is simply if there is a way to find this form on the filesystem and fix it there?
I'm also baffled that there is no check in the function that tries to sum numbers, that catches this error ...


texts: if I change site with local devdesktop it will not change anything with my live site?

texts:
I am new so bare with me! I am using a local acquia dev desktop 2 beta and want to make sure if I play around with it in drupal it will not change anything with my live site.

We do not host with acquia so I am sure it wont but I want to make sure anything I do does not translate to the mysql?

Again, I am apologize if this is a newbie question.
Thanks.


texts: Why is my form only redirected sometimes?

texts:
I want to have a user register, and be redirected to a node create form. Here's how I'm doing it thus far.

The setup

I have a route, my_module.register that is handled by MyController::register(). It returns the user register form, like so:

class MyController extends ControllerBase {
  public function register() {
    return $this->entityFormBuilder->getForm(User::create([]), 'register');
  }
}

I also have this service, my_module.form_alter_service (just pretend all the implied dependency injection is there):

class MyFormAlterService {

  public function registerFormAlter(array &$form, FormStateInterface $form_state) {
    if ($this->currentRouteMatch->getRouteName() == 'my_module.register') {
      $form['actions']['submit']['#submit'][] = [$this, 'redirectToAddNode'];
    }
  }

  public static function redirectToAddNode(array &$form, FormStateInterface $form_state) {
    $form_state->setRedirect(/* imagine a node form route here */);
  }

}

I have also implemented hook_form_FORM_ID_alter():

function my_module_form_user_register_form_alter(array $form, FormStateInterface $form_state) {
  \Drupal::service('my_module.form_alter_service')->registerFormAlter($form, $form_state);
}

The expected behavior

I fill out the user register form at /my_module/register, hit submit, and am taken to the desired node add form.

What happens instead

I fill out the user register form at /my_module/register and end up on my user edit page.

But then, if I delete that user, clear the cache, and repeat the process with the exact same credentials, it works as expected.

What I know

I am getting debugging output from every part of the process, so I know each part is running.
I am using the exact same pattern for the login form; identical code in the form alter, and that works great.
I can also get debug output from Drupal/user/EventSubscriber/AccessDeniedSubscriber::onException() which redirects authenticated users who are visiting the user.register route to their edit page. So I know that's causing the unwanted redirect, when the unwanted redirect happens.
I tried removing the user.roles:authenticated cache context from the form, and adding user, but that didn't seem to change things.

The actual question(s)

Why is the form initially not respecting the redirect I set in the submit handler? Why does a cache clear change that behavior?


texts: Comment migration working? (D5 --> D7) View displaying comments not

texts:
I thought I had this piece of the migration sorted, but I'm not sure what's off. As far as I know these are the places comment info is stored:

comment
field_data_comment_body
field_revision_comment_body
node_comment_statistics

I'm using a stored procedure to migrate the comments from the D5 db to the first three tables in the above list, the data appears to match what's generated by the native comment submission. After the stored procedure I run devel_rebuild_node_comment_statistics();

The results in the node_comment_statistics table look promising but some comments (rather their record in this table) are missing, or (after typing this all out) I'm realizing that this table probably doesn't store a record for every comment, just the last comment for that node (and comment count, etc).

Regardless, some comments won't display, even though their db records appear the same as neighboring comments that do display. I suspect this has to do with a subtle change in how the comment hierarchy is stored?

Also, (could be coincidence), one of the MIA comments did not have a record in the node_comment_statistics table, but this may be normal/works as designed.

The SQL statement within devel_rebuild_node_comment_statistics(); MIGHT be part of my issue (not blaming the function because it may not have been designed for how i'm using it) here is the function's SQL:

  SELECT c.nid, c.cid, c.created, c.name, c.uid, c2.comment_count FROM {comment} c
  JOIN (SELECT c.nid, MAX(c.created) AS created, COUNT(*) AS comment_count FROM {comment} c WHERE STATUS = 1 GROUP BY c.nid)
  AS c2 ON c.nid = c2.nid AND c.created = c2.created

Let me know if you need more info, or have an approach suggestion. Thanks!

UPDATE: So on a clean D7 install w/ devel generate, i'm seeing that a record is created not for every comment, but for every node in node_comment_statistics. The zero comment records are probably not related to my issue. Comparing the results of devel_rebuild_node_comment_statistics(); to native comment storage, everything seems fine w/ the function, so something is wonky in my comment migration.


texts:
I am a newbie into Drupal.
I recently learned to create custom Drush command inside a custom module. I am wondering if I can write a custom drush command and its definition without any module or outside module. for eg. If I have no custom module in my drupal project.
This custom command is available for execution only if my module is enabled. Can I write a drush command which is completely module independent?

Is it possible?


texts:
I am trying to create a module with a simple form. The form allows the user to enter their address, from there I need to take the user's address, make a geocoding request, then send the data to another api, and then I need to display the data from the api request.
The part I am having issues with is taking the submitted address so I can do the requests with it. How do I take the data from the form so I can use it? I do not need or want to save the data into my database.

Thanks in advance.


texts:
How to retrieve value of hidden field in twig?

PFB screenshot:

I am able to retrieve value of "Partition Count" field when not disabled. But not able to retrieve it's value when disabled.

Exact requirement:
1) If "Partition Count" field is Disabled from Drupal Admin, then field should not be displayed. But this value needs to be retrieved in twig file as display of "Reference Paragraph" will vary according to the value of "Partition Count".

2) If "Partition Count" field is Enabled from Drupal Admin, then field should be displayed. In this case, I am able to retrieve "Partition Count" field value in twig file.

paragraph.html.twig:: https://github.com/WondrousLLC/paragraphs_starter_pack/blob/master/template/paragraph/paragraph.html.twig


texts: How get Superfish to display on mobile device?

texts:
I installed the Superfish Module and Library and it works on a desktop/laptop/tablet. It collapses correctly when I re-size the screen. But it won't display at all on a mobile device. I tried different settings on the Config page and tried adding the recommended code in html.tpl.php:
meta name="viewport" content="width=device-width, initial-scale=1.0"
I enabled SF-Smallscreen with the jQuery sf-Smallscreen plugin. Made sure it was weighted to appear at the top of all the blocks.
Still no luck.


texts:
I'm trying to get the Search API module to work on my Drupal 7 installation, but I get the following error when I go to Home » Administration » Configuration » Search and metadata » Search API » Default node index:

  The server this index currently lies on doesn't support facets. To use facets you will have to move this index to a server supporting this feature.

What steps should I follow, in order to make my server compatible with the Search API module?


texts: How to count the total number of cores in apache solr 3.5?

texts: I am using apache solr 3.5 for one of my Drupal 7 sites. As per a requirement i am supposed to count the total number of cores present in the solr. I am using multicore instance. Is there any option by which i can get the number of cores?


texts: Bypass publish approval on content creation for a certain role

texts:
I have a content type "place" which can be created by any registered user but needs to be published by a "site editor" role. I also have a "place editor" role which will have his "place" content published as soon as it is created, not needing an approval.

There are other content types such as "event", which will have their own editors, so that a "place editor" will have to have his "event" content published by a site editor, but his "place" content will be published right away.

Can you name a module for this? I am using drupal 7


texts:
It looks like when you use the default Bootstrap subtheme, it renders a navbar with the Main Menu links at the top of the page, as
...
 elements inside of a navbar-nav block. How can one, instead of using
..., instead use
...
, so that my navbar has links styled as buttons instead of normal links?

I'm using the Bootstrap 7.x-3.0 subtheme. Thanks in advance!


texts: Drupal 7: Displaying external SQL-table as paginated list

texts:
The following code works well for displaying a paginated list of Drupal users:

function generate_list() {
  $query = db_select('users', 'u')
    ->extend('PagerDefault')
    ->fields('u', array('name', 'uid'))
    ->orderBy('created', 'DESC')
    ->limit(20);

  $result = $query->execute();

  $list = array();
  foreach ($result as $row) {
    $list[] = sprintf('%s', $row->uid, $row->name);
  }

  $theme_args = array('items' => $list, 'type' => 'ul');
  return theme('item_list', $theme_args) . theme('pager');
}

But when I try fetching from an external SQL-table called pref_users (my site embeds a card game and some users come from outside - through Facebook and other social networks, so I have to maintain some non-Drupal SQL-tables, in the same database where Drupal data is stored) with this code:

function generate_list() {
  $query = db_select('pref_users', 'u')
    ->extend('PagerDefault')
    ->fields('u', array('first_name', 'id'))
    ->orderBy('created', 'DESC')
    ->limit(20);

  $result = $query->execute();

  $list = array();
  foreach ($result as $row) {
    $list[] = sprintf('%s', $row->id, $row->first_name);
  }

  $theme_args = array('items' => $list, 'type' => 'ul');
  return theme('item_list', $theme_args) . theme('pager');
}

then I unfortunately get the error:

PDOException: SQLSTATE[42P01]: Undefined table: 7
ERROR: relation "drupal_pref_users" does not exist at character 67:
SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression
FROM {pref_users} u) subquery; Array ( ) in method
PagerDefault->execute() (line 75 in file includes/pager.inc).

Does anybody please know a way to tell Drupal to fetch data simply from pref_users and not from {pref_users} at it seems to assume above?


texts:
I have reCaptcha (Google recaptcha) for my site by using module recaptcha

It's working good but I need to change language to my local language.

I've read language code

https://developers.google.com/recaptcha/docs/language

But I don't know how to do it in the module

Thanks


texts:
I have a bunch of views/reports built for my client. The reviewers then click download csv for the excel file. They asked if the views could download themselves daily to a folder.

Is that possible? And could you share links or knowledge how to handle this. I have been trying to figure it out.

Note: Right now the user is downloading CSV's from Drupal 7, an install of Moodle 1.9 in a Drupal 6 Shell and Survey Monkey. After they download and combine using Excel, the user creates reports that way for the users we have come to our events. Being a Front-end developer, coding is not my strength.


texts: Migrating Pixture Reloaded theme to drupal 7.x

texts:
I'm migrating a drupal6 site to Drupal 7 which uses Pixture Reloaded as its default theme. In Drupal 6, Pixture Reloaded was standalong theme which required no base theme but now I see that for Drupal 7 versions, its a subtheme of Adaptivetheme.

How do I migrate my old theme to new Pixture reloaded for Drupal 7? Is there a upgrade path for the migration?? I have now added and enabled both Adaptive and Pixture reloaded theme and have set the default theme to Pixture relaoded. As expected, most of the views, panels and blocks are broken but pages look fine.

Any pointers for the migration/upgrade would be helpful.


texts: Filter menu parent dropdown by language for multilingual site?

texts:
I am working on a multilingual site that has about 60+ pages per language. When an admin user wants to add a page to the navigation menu its becoming quite the task because literally every single link (from all languages) is listed in Main Menu. Its even more confusing because the site has some cases where French and German are in the menu twice because the site has Canada-French and France-French as a language.

Is there any way to manage the navigation menu better? Like if I select German for the language could the menu dropdown automatically filter itself to just show the German nav items? Right now we have a list of about 300+ items in the dropdown :(


texts: How do I get a count of comments by querying the database table?

texts:
I'm migrating my Drupal forum and trying to export MySQL base as CSV. Among other things, I need to get comment counts.

How can I achieve it?

To be clear, this is what I have up to now:

SELECT node.nid, forum.tid, node_revisions.uid, node_revisions.title, node_revisions.body
FROM node, forum, node_revisions
WHERE node.vid=node_revisions.vid AND node_revisions.vid=forum.vid AND type='forum'

And I also would like to get comment counts for every node.

To be even more clear, this is what I would like to get.

| nid  | taxonomy id | author   | title      |  body       |comments count|
|------|-------------|----------|------------|-------------|--------------|
| 3    | 2           | 1        | Topic 1    | Topic body..|(I need this!)|
| 7    | 3           | 3        | Topic 2    | Topic body..|(I need this!)|
| 2068 | 2           | 287      | Topic 3    | Topic body..|(I need this!)|
| 12738| 4           | 4        | Topic 4    | Topic body..|(I need this!)|

The last column is what I need to get.


texts: Alternative, more secure user registration process wanted

texts:
I don't like that Drupal 7 exposes at the registration page whether the provided e-mail is known by displaying a "The e-mail address xx@xx.xx is already registered. Have you forgotten your password?" message.

I would prefer if it only lets the user know that the process has been initialized, and depending on the status of the e-mail it either sends out a normal registration e-mail or a password reset.

What would be the best way (the closest to Drupal's philosophy) to implement such a feature?

Is this a module?

Could it be accomplished by reconfiguring the fields of the user account?


texts: How to translate Select List options used in exposed filters of a view?

texts:
I'm having an issue with translation of exposed filters in Views.

I'm using a text list field as an exposed filter in my view. The problem is that even though I translated the list terms via strings (Regional and Language >> translate interface >> translate) the terms always appear in the original language.

I checked but there is not an option in the view to show the translated terms in the filter. There are other exposed filters translated the same way that appear in the correct language, but they're not select lists but taxonomy terms.

I also checked the advanced views settings and the Localization translation method is already on "core". I don't know what else to check.

I'm using Better Exposed Filters and MEFIBS - More exposed forms in blocks for the exposed filters (I'm not sure if this may be related).


texts: How to load a internal page content within div?

texts:
I have following code in a basic page on drupal 7

Test Title

Test Nav

Content of the above internal link should display here.

So, when I click "Test Nav",  the content of the like which is originating from the same site should load within the div below.

EDIT: The content is from another page is part of a CRM form which gets generated automatically. So what I need to load is the “content” part of that linked page.  I have managed to load the page by “object load”, but that loads the entire webpage. I do not need the menu, header, footer. Just the content part of it. Hope this clears the query.

Can anyone suggest a way to do it please?


texts:
Hi there I'm trying learn how to rewrite a #id of an exposed filter block (ie. a searchbar filtering a list view. Is there an easy way to do this?

Isn't something that is possible to do with rules?

(i would like to get an answer with an example of how to do the rewrite inc. an example of a syntax as I'm no guru on php or rules either for that matter :)


texts: Drupal 7 cron does not run civicrm Scheduled Jobs

texts:
I'm using Drupal 7, and set the cron job to run every hour.

However, when drupal cron runs, my CiviCrm schedule jobs does not run. These schedule jobs run only when I click the link "run all scheduled jobs manually".

Is there any way I can configure drupal cron job to run CiviCrm schedule jobs too?

Or I need to install any additional module, or configure setting so that the CiviCrm schedule jobs can run automatically?


texts:
I have isolated my error to the field_create_instance($instance) line but can't make sense of what I'm doing wrong.

function my_module_quote_add_qid() {
$field = array(
    'field_name' => 'qid',
    'type' => 'text',
  );
  field_create_field($field);
  $instance = array(
    'field_name' => 'qid',
    'entity_type' => 'node',
    'bundle' => 'product',
    'label' => t('qid'),
    'widget' => array(
      'type' => 'textfield',
    ),
  );
  field_create_instance($instance);
}

my_module_quote_add_qid();

This is what my error looks like:

Notice: Undefined index: view modes in EntityDefaultRulesController->eventInfo() (line 51 of /var/www/seven/sites/all/modules/entity/entity.rules.inc).
Notice: Undefined index: schema_fields_sql in DrupalDefaultEntityController->buildQuery() (line 265 of /var/www/seven/includes/entity.inc).
Recoverable fatal error: Argument 2 passed to SelectQuery::fields() must be an array, null given, called in /var/www/seven/includes/entity.inc on line 284 and defined in SelectQuery->fields() (line 1300 of /var/www/seven/includes/database/select.inc).


texts: How to disable multiple cardinality for a custom field

texts:
I've made a custom module that creates a new field type. Any single-cardinality instances of this field work fine.  However, multi-cardinality instances of this field will not pass my #element_validate function; see https://drupal.stackexchange.com/questions/86745/element-validate-function-is-called-on-sub-elements-of-a-form-form-items-are-c

Since I don't need this field to ever be multi-value, I want to disable multiple values for this field entirely.

Is there a way to do this?


texts: How to show categories and regarded node in drupal 7

texts:
I have a site in Drupal 7. I am using brands(taxonomy term) and product(node).
For example I have 4 brand -- brand1 brand2 etc.. I need to show all 4 brands and regarding node .. When I click on brand 1 . then brand1 related node need to show..

I need something like this structure..
 display all terms on left and right all regarding products.


texts: How do I validate an entity before programmatically saving it?

texts:
I have various functions/methods that programmatically create entities (nodes). I just noticed that invalid data has been getting stored in the db though these functions (invalid in that it doesn't meet the rules defined for that field).
How do I validate the data before $entity->save()?
I have seen documentation saying that I simply need to do $entity->validate() and then count if there are any errors; but I have marked a few fields as required and then left them empty in my API function and $entity->validate()->count() is always 0.
What am I missing?


texts:
Is the "Verbose logging" in Drupal actually the PHP errors that can be activated in various ways (.htaccess, php.ini, settings.php) to be seen on screen?

Is it drush ws --full ?

From the material I've seen I can't say for sure if there is a unique definition for this concept in Drupal.

I would thank an experienced Drupal programmer to give the final word on this.


texts:
I have two forms on a node page (the comment one + a custom form). Ajax is not enabled for both of them but still, when submitting the custom form form_set_error or durpal_set_message are not displayed but displayed when you load a new page (if you submit the form again, if you reload a page or if you change the page). It's like I have a hidden ajax behavior messing the submit up.

function my_module_quote_request_form($form, &$form_state) {
  global $user;
  $account = user_load($user->uid);

  $user_phone_number = $account->field_user_address[LANGUAGE_NONE][0]['phone_number'] ? $account->field_user_address[LANGUAGE_NONE][0]['phone_number'] : '';

  $form = array();

  $form['phone_number'] = array(
    '#type' => 'textfield',
    '#title' => t('Phone number'),
    '#default_value' => $user_phone_number,
    '#size' => 30,
    '#maxlength' => 10,
    '#required' => TRUE,
  );

  $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array(
    '#title' => t('Submit'),
    '#type' => 'submit',
    '#value' => t('Request'),

  );
  $form['actions']['cancel'] = array(
    '#title' => t('Cancel'),
    '#markup' => l(t('Cancel'), '/market'),
  );

  return $form;
}

function my_module_quote_request_form_validate($form, &$form_state) {
  if (blabla) {
   form_set_error($phone_number, $message);
  }
}

If you trigger blabla, then the message is not displayed but displayed on page reload.

Any idea what it can due to?