texts: Taxonomy term not displayed in the current language

texts:
My setup is simple:

A content type "film" with a taxonomy field "Type of film".

The content type "film" is translatable, but not the field "type of film" (same type for all languages): only the entity type "Type of film" is translatable.

If I display a film with an English interface, I will get "Comedy" as the type of the film and in French, I will get "Comedie".

If I create a view showing the films teasers, I will have Comedy/Comedie depending if I ask to display French or English films.

Until this point, everything runs fine...

But, as all the films are not translated, I would like to have Comedie if it is a French interface (http://domain/fr) even if the teaser is displaying an English (not translated) film.

In the view, I have used

FILTER CRITERIA: Content: Default translation (= True)

LANGUAGE: Rendering Language:Interface text language selected for page

In the Manage display of the film's teaser, I choose "label" to display my taxonomy field... without any option to display it into the current language (now it is displayed into the content type language)

EDIT TO ADD:

Following the advise from @Berdir, I have created a new formatter: /my_module/src/Plugin/Field/FieldFormatter/CurrentLanguageLabelFormatter.php

<?php

namespace Drupal\artprod\Plugin\Field\FieldFormatter;

use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Entity\TranslatableInterface;
use Drupal\Core\Field\EntityReferenceFieldItemListInterface;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceLabelFormatter;

/**
 * Plugin implementation of the 'current language label' formatter.
 *
 * @FieldFormatter(
 *   id = "current_language_label",
 *   label = @Translation("Current Language Label"),
 *   description = @Translation("Display the label of the referenced entities using the language of the page."),
 *   field_types = {
 *     "entity_reference"
 *   }
 * )
 */
class CurrentLanguageLabelFormatter extends EntityReferenceLabelFormatter {

    protected function getEntitiesToView(EntityReferenceFieldItemListInterface $items,$langcode) {
        $entities = [];

        foreach ($items as $delta => $item) {
            // Ignore items where no entity could be loaded in prepareView().
            if (!empty($item->_loaded)) {
                $entity = $item->entity;

                // Set the entity in the current language for display.
                // HERE IS THE CHANGE
                if ($entity instanceof TranslatableInterface) {
                    $language = \Drupal::languageManager()->getCurrentLanguage()->getId();
                    $entity = \Drupal::entityManager()->getTranslationFromContext($entity, $language);
                }

                 $access = $this->checkAccess($entity);
                // Add the access result's cacheability, ::view() needs it.
                $item->_accessCacheability = CacheableMetadata::createFromObject($access);
                if ($access->isAllowed()) {
                    // Add the referring item, in case the formatter needs it.
                    $entity->_referringItem = $items[$delta];
                    $entities[$delta] = $entity;
                }
            }
        }

        return $entities;
    }
}

In the annotation, I have changed the id and the description

In the class body, I have copied the function getEntitiesToView from the class EntityReferenceFormatterBase except that I changed the chunk of code which is translating the entity.

After restarting Apache and clearing the cache, I could select this overrided formatter for my taxonomy field.... AND the label are now displayed in the current language (vs language of the parent entity)


texts: How do I get the path or url to commerce product for views-view-fields.html.twig

texts:
I use the commerce module and VIEWS to build a product list. For this product list I like to have an output like this:

product 1

Some description

product 2

Some description

                  ...

It is a list where you have clickable items and the click have to link to the detail page of the product. So, my questions is: how do I get the path or url to product, which I can use in twig file views-view-fields--productList.html.twig?

    {% for field in fields -%}
    {{ field.separator }}
    {%- if field.wrapper_element -%}
      <{{ field.wrapper_element }}{{ field.wrapper_attributes }}>
    {%- endif %}
    {%- if field.label -%}
    {%- if field.label_element -%}
    <{{ field.label_element }}{{ field.label_attributes }}>{{ field.label }}{{ field.label_suffix }}</{{ field.label_element }}>
  {%- else -%}
    {{ field.label }}{{ field.label_suffix }}
  {%- endif %}
  {%- endif %}
  {%- if field.element_type -%}
  <{{ field.element_type }}{{ field.element_attributes }}>{{ field.content }}</{{ field.element_type }}>
  {%- else -%}
    {{ field.content }}
  {%- endif %}
  {%- if field.wrapper_element -%}
    </{{ field.wrapper_element }}>
  {%- endif %}
  {%- endfor %}


texts: How do I create different landing pages?

texts:
I am newbie to Drupal and I have deadline to make a website. So, I apologize if this question sounds silly to you..

I wanted to create a website that has one front page and 8 different landing pages. I have created front page. But I am not sure what is the best practice to create 8 different designed landing pages that are going to be use for the entire website.

For example:

"About" page uses 2 column layout.
"Contact Us" page uses 3 column layout.
"News" page has flexible layout and so on.
Also, News page has two image boxes with contents.

So, how do I create image box for one of my landing page?

So, can any one please guide me how do I create different landing pages?
I know there are several methods like, using panels, views and mini-panels we can create different landing pages. But, can any one suggest me good video tutorial and documentation for that?

Many Many Thanks!!


texts:
I am trying to disable modules in Drupal 8, and I found some solution like Drupal console, but I am not sure how to use it with XAMPP.

I am unable to understand how I can disable a Drupal 8 module. With Drupal 7, that was possible directly from the user interface, but in Drupal 8 the checkboxes shown before the module name are disabled.

How do I disable a module in Drupal 8?


texts:
I am working on flex slider module and I want to add one button in caption so for that I have added one field in content type with Machine name: field_image_url and Field Type: text.

Now I am changing in core file of the module to fetch that URL into the front end.For that code is below:

    <?php
    /**
     * @file
     * Default output for a Flex Slider node.
    */
    ?>

      <div class="flexslider-content flexslider clearfix" id="flexslider-<?php print $id; ?>">

        <?php foreach($items as $item) : ?>

<?php print render($item); ?>
            <?php if(!empty($item['#item']['title']) || !empty($item['#item']['alt'])) : ?>

<?php print $item['#item']['alt'];?>

<?php print $item['#item']['title']; ?>

             <?php if(isset($node->field_image_url)): ?>
                <a href="<?php print render ($node->$field_image_url); ?>" class="btn btn-theme">Learn More
             <?php endif; ?>

            <?php endif; ?>

        <?php endforeach; ?>

I know I am making some mistake as I am very new to drupal development.

     <?php if(isset($node->field_image_url)): ?>
        <a href="<?php print render ($node->$field_image_url); ?>" class="btn btn-theme">Learn More
     <?php endif; ?>

Above code is for fetching URL.It is not giving me any error, but it is also not showing me the button.I have already entered URL for one slide.

Where am I lacking ?

Edited :

I want to also mention that Slider is on front page and there is an article content just below to the slider.

I have given node path to the front page from the Configuration to show it on front page.

So now, If I do

     <?php
        if (arg(0) == 'node' && is_numeric(arg(1))) {
          // Get the nid
          $nid = arg(1);
          // Load the node if you need to
          $node = node_load($nid); print_r($node);
        }
     ?>

It is giving me the node ID of the article.I want the node ID of the slider Image so that I can pull out the image URL field that I have added to the Slider Image Content type.

EDITED:

    <?php
        //this code will load all nodes from your content type and then print them
        $node_type = "slider_image";
        $result = db_query("SELECT nid FROM node WHERE type = '%s' ", $node_type);
        $nodes = array();
        while ($obj = db_fetch_object ($result)) {
          $node = node_load($obj->nid);
          echo $node->field_image_url['und'][0]['value'];
          echo '
';
          $nodes[] = node_load($obj->nid);
        }
    ?>

I have tried above code but it is giving me an error :
Recoverable fatal error: Argument 2 passed to db_query() must be of the type array, string given, called in path to modules\modules\flexslider\theme\flexslider-container.tpl.php on line 19 and defined in db_query() (line 2345 of path to site\includes\database\database.inc).

So to resolve above error, I tried following code with help of this:

$result = db_query("SELECT nid FROM node WHERE type = ':type' ", array(':type' => $node_type));

But above code also gives me error : Fatal error: Call to undefined function db_fetch_object() in path to module\modules\flexslider\theme\flexslider-container.tpl.php on line 21


texts: Change height of CKEditor (per profile) without using WYSIWYG Module

texts:
Problem

How can I change the height of the CKEditor window without using the solution outlined here which requires the WYSIWYG module. I can't spot where the height is defined in the CK module.

Ideally I'd like to be able to set it per profile and I'd prefer not to add an extra module if possible.

Has anyone dealt with this before?


texts: Custom field type: make only one specific property translateable

texts:
Is it possible to mark only a single property of a field as translateable?

E.g. I have a custom field type RoomRates with 2 properties uri and price_mode.

/**
 * Plugin implementation of the 'kognitiv_room_rate' field type.
 *
 * @FieldType(
 *   id = "kognitiv_room_rate",
 *   label = @Translation("Kognitiv room rate"),
 *   description = @Translation("Stores an URL to retrieve price and availability data for a room"),
 *   default_widget = "kognitiv_room_rate",
 *   default_formatter = "kognitiv_room_rate",
 *   cardinality = 1,
 *   column_groups = {
 *     "uri" = {
 *       "label" = @Translation("URI"),
 *       "translatable" = TRUE
 *     },
 *     "price_mode" = {
 *       "label" = @Translation("Show prices as")
 *     }
 *   }
 * )
 */
class RoomRate extends FieldItemBase implements LinkItemInterface {

  const PRICE_MODE_PERSON = 'PERSON';
  const PRICE_MODE_DAY = 'DAY';

  public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
    $properties['uri'] = DataDefinition::create('uri')
      ->setLabel(t('URI'))
      ->setRequired(TRUE);

    $properties['price_mode'] = DataDefinition::create('string')
      ->setLabel(t('Show prices as'))
      ->setRequired(TRUE);

    return $properties;
  }

  /**
   * {@inheritdoc}
   */
  public static function schema(FieldStorageDefinitionInterface $field_definition) {
    return [
      'columns' => [
        'uri' => [
          'description' => 'The URI of the JSON API endpoint.',
          'type' => 'varchar',
          'length' => 2048,
        ],
        'price_mode' => [
          'description' => 'Show prices as price per day or price per person in std occupancy',
          'type' => 'varchar',
          'length' => 10,
        ],
      ],
      'indexes' => [],
      'foreign keys' => [],
    ];
  }

The uri property should be translateable (if the site builder enables translation for this field), while the price_mode property should never be translateable/always be the same accross all languages (no matter if the site builder enabled field translation or not).


texts: Problem with getting number of nodes created by a user in a View

texts:
I know this question is already asked, here is a few links How to count the node a user has created in a View? or How can I count the number of nodes submitted by the current user?

This is a very simple task but I am facing a problem.
I'm trying to get the number of nodes of a certain content type created by a user. This is the configuration of the view:

setting Author uid as contextual filter
setting the content type in filter criteria and selecting Node ID as field
setting aggregation to yes and set the nid to use the Count Distinct aggregation
Setting the Pager to Display all items

If I don't use the aggregation this is the result:

2158
2151
2152
2153
2154
2155
2156
2157
2142
2143
2144
2145
2146
2147
2148
2149
2150
2141
2140
2139
2138
2137
2136
2127
2126
2125
2124
2123
2128
2129
2130
2131
2132
2133
2134
2135
2122

But if I use it, the result is :

8
15
14

which 8+15+14 = 37 and number of the nodes is also 37 but I wonder why it displays the 37 this way?


texts: How to use wysiwyg text editor (text_format) in a system configuration form

texts:
I couldn't find any documentation or examples about this. The implementation is very problematic. Do you a means to do this?

Problems

While trying to create a system settings form with text_format input, I get following errors while displaying the form. The form is being submitted normally and the values are being saved but when the page refreshes the text editor is not populated with the saved values and the errors are always there.

  User error: "value" is an invalid render array key in
  Drupal\Core\Render\Element::children() (line 97 of
  core/lib/Drupal/Core/Render/Element.php).

  User error: "format" is an invalid render array key in
  Drupal\Core\Render\Element::children() (line 97 of
  core/lib/Drupal/Core/Render/Element.php).

The code in buildForm() is as follows:

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $config = $this->config('commerce_distance_terms.distanceterms');
    $form['title'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Title'),
      '#description' => $this->t('Title for the terms'),
      '#maxlength' => 64,
      '#size' => 64,
      '#default_value' => $config->get('title'),
    ];
    $form['distance_selling_terms'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Distance Selling Terms'),
      '#description' => $this->t('Enter Distance Selling terms'),
      '#default_value' => [
        'value' => $config->get('distance_selling_terms.value'),
        'format' => $config->get('distance_selling_terms.format'),
//         '#tree' => FALSE,
        '#printed' => TRUE,
      ],
    ];
    return parent::buildForm($form, $form_state);
  }

Background information

This is the error as it links from the code.
The errors are thrown because of the #default_value part of the array. Adding a #value => array() reduces the errors. But nothing changes.
What I got from the stacktrace is that the form is being rendered, then the textarea is being rendered, and then the source of the error is being rendered (There are small elements inbetween). So I think the source of the error is the #default_value element of the textarea which is copied and pasted from the above array part while the compound text editor is being created.
In one of the rendering iterations, the Element::children() thinks that it should render the value and the format elements of the above array. Since they don't start with #.
There is a word here that system settings form doesn't support text_area input from Drupal 7. Also that and some linked issues tell that there are some automatic defaults for system_settings_form but I couldn't find the equal.
The text_format input is a compound element that includes a textarea (to hold and populate the actual value), a dropdown format element to select from, etc. The textarea element comes with the exact #default_value that I put above (as an array). I tried to preprocess this textarea and change that value to the related string to populate the field but whatever I do textarea comes always empty.
The #printed and #tree elements of the array don't change anything. I also put them inside the textarea array in the preprocess function but nothing changed.
The textarea's data-editor-value-original property comes with the above array flattened even tough I change the #default_value and #value in the preprocess.
The text editor not being able to be populated may not be related to above errors. I know nothing.


texts: Making an Entityform field required using jQuery

texts:
I have an Entityform and defined dependencies to where if a particular value is selected from one of the drop downs, the resume field (file upload) should be required.

I don't know why, but it's currently not working. It marks the resume field as required, but still lets the application submitted with no error.

I noticed all the required fields (that do work) have a class of required in their markup. Is it possible I can do this in jQuery? Meaning that I check that dropdown and if a certain value is selected, I'll add the required class to the file upload (resume) field.


texts: How to list page translations next to the original in the same row?

texts:
D8's multilingual features are way above average compared to other major competing solutions, but I'm still missing one feature, or I don't know about it being implemented in D8.

When I create transations of the same page, I see them on individual rows, one row per translation like this:

If you have more languages, let's say 5, it's not good for clarity to have it like this. It would be much more clear if it would be possible to display the page (original) in one row and to list all the available translations of the given page on the same row, like this:

Being able to do this in D8 would be a great benefit. Is this possible in D8?


texts: Drush commands failing with remote database and no local MySQL

texts:
I am attempting to run cron via crontab on a server that has a remote database, as such there is no mysql isntance installed locally.

When attempting to run the command drush core-cron i received the following error.

[warning] The command 'mysql' is required for preflight but cannot be found.

The full debug output is below

debug] Bootstrap further to find core-cron
 [debug] Trying to bootstrap as far as we can
 [bootstrap] Drush bootstrap phase: bootstrapDrupalRoot()
 [bootstrap] Change working directory to /var/www/wwwroot/web
 [bootstrap] Initialized Drupal 8.5.3 root directory at /var/www/wwwroot/web
 [bootstrap] Drush bootstrap phase: bootstrapDrupalSite()
 [bootstrap] Initialized Drupal site default at sites/default
 [bootstrap] Drush bootstrap phase: bootstrapDrupalConfiguration()
 [debug] Add service modifier
 [warning] The command 'mysql' is required for preflight but cannot be found. Please install it and retry.
 [debug] Bootstrap phase bootstrapDrupalDatabase() failed to validate; continuing at bootstrapDrupalConfiguration()
 [debug] Done with bootstrap max in Application::find(): trying to find core-cron again.

In Application.php line 238:

  [Symfony\Component\Console\Exception\CommandNotFoundException]
  Command core-cron was not found. Drush was unable to query the database. As
   a result, many commands are unavailable. Re-run your command with --debug
  to see relevant log messages.

Exception trace:
 Drush\Application->bootstrapAndFind() at /var/www/wwwroot/vendor/drush/drush/src/Application.php:191
 Drush\Application->find() at /var/www/wwwroot/vendor/symfony/console/Application.php:229
 Symfony\Component\Console\Application->doRun() at /var/www/wwwroot/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /var/www/wwwroot/vendor/drush/drush/src/Runtime/Runtime.php:112
 Drush\Runtime\Runtime->doRun() at /var/www/wwwroot/vendor/drush/drush/src/Runtime/Runtime.php:41
 Drush\Runtime\Runtime->run() at /var/www/wwwroot/vendor/drush/drush/drush.php:66
 require() at /var/www/wwwroot/vendor/drush/drush/includes/preflight.inc:17
 drush_main() at phar:///usr/local/bin/drush/bin/drush.php:141
 require() at /usr/local/bin/drush:10


texts: Check if the entity is new from the entity insert hook

texts:
I have a custom content type, when I create a new content of this type via the admin ui I want be redirect to the edit page of the new node (not to the view page by default)

So, from an alter form hook, it's not possible because I don't know yet the node ID of the future node. From hook_entity_presave() it's the same: I don't know yet the node ID of the future node. From hook_entity_insert() hook, I have the node ID, but I don't know how can I check the entity is just created.

From hook_entity_insert(), is it possible to know if the entity is just created?


texts:
Is there a difference in the use of hook_preprocess_HOOK()?

In Drupal 8 when I use :

hook_preprocess_page
hook_preprocess_node
hook_preprocess_block

All my Implements for page, node or block work good.

But when I use hook_preprocess_menu some staff don't want to work, what work in preprocess function up.

For example:

This work perfect

function theme_name_preprocess_page(&$variables) {
  $variables['logopath'] = '/' . drupal_get_path('theme','theme_name') . '/logo.png';
}

But this don't work.

function theme_name_preprocess_menu(&$variables, $hook) {
$variables['logopath'] = '/' . drupal_get_path('theme','theme_name') . '/logo.png';
  }


texts: How to limit preprocess functions base on a theme?

texts:
I'm working on a theme that using hook_preprocess_node and hook_preprocess_page and everything is working fine. However, whenever I go to any admin pages, it's throwing me some errors because the array changes. So what I'm trying to achieve is to add a condition only to run this preprocess function if using my theme.

How can I limit the preprocess function base on my theme?


texts: How to get a text field with each radio input in cck

texts: I want to have a text field input in front of every radio input so, that when a user selects a radio input the appropreate textfield will appear infront of every radio input in node/add


texts: Correct way to massively change node author

texts:
I want to change all the nodes where $user1 is author and set $user2 as author.
I use this PHP Code and it works, but is it the correct way to do it?
Or should I use a batch process and load each node to change the author?

   $num_updated = db_update('node')
      ->fields(array(
        'uid' => $user2->uid,
      ))
      ->condition('uid', $user1->uid, '=')
      ->execute();


texts:
I want to log in Drupal 8 users from an external PHP file. I am trying the following code.
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
use Drupal\user\UserInterface;
//$autoloader = include('/vendor/autoload.php');
$autoloader = require_once __DIR__ . '/vendor/autoload.php';
$kernel = new DrupalKernel('prod', $autoloader);

$request = Request::createFromGlobals();
$response = $kernel->handle($request);

// ID of the user.
// REPLACE WITH WHATEVER ID YOU WANT TO LOGIN AS;
$uid = 100;
$user = Drupal\user\Entity\User::load($uid);

// This is required to call user_login_finalize here.
$kernel->prepareLegacyRequest($request);
user_login_finalize($user);

$response->send();

$kernel->terminate($request, $response);

When I run it, I get the following error.

TypeError: Argument 1 passed to user_login_finalize() must implement interface Drupal\user\UserInterface, null given, called in /var/www/html/stocksee/public_html/component/login.php on line 22 in user_login_finalize() (line 554 of core/modules/user/user.module).

Please help me.


texts: How to correctly remove a module in a staged environment?

texts:
Some modules have deïnstallation routines. Which typically remove databasetables for that module, variables from the variable table and locales introduced by that module. These routines live in the .install of that module.

Therefore, they cannot be ran without that module being present. So here are our current steps. My question is: can this be done simpler and more effectively? Say I remove foo_bar module.

In the RCS, prepare a new release, where:

All css and theme-overrides that use or build on top of- foo_bar are removed.
All css and theme-overrides for modules depending on foo_bar are removed.

Push that release to acceptance. Test the deïnstallation (from admin/modules) with a very recent copy of the production database.
If all goes well, deploy the new codebase to production, and deïnstall foo_bar and its dependencies there. This will invoke the uninstall in the various modules, cleaning up the database.
In the RCS (git), prepare a new release where the code is actually removed.
Deploy that to acceptance where we test if nothing accidentally depended on this (some ugly modules or theme functions include files directly from other modules. Most notably CSS, JS or image-files).
If accepted, deploy new release to production. production now has a clean database and a clean codebase.

Problem that I can't see how to solve, is that this always needs two releases. Since in Drupal a release requires the site to be offline, this means two times downtime just to remove one module. It also requires two release procedures, which, in professional hosting environments can be very expensive, time-consuming or frustrating.

If we remove the module from codebase in the first iteration, we cannot run the uninstall hooks, keeping many lint in the database; not just a few tables, but mostly variables and locales.
If we don't remove the module from codebase, that means the codebase will grow with stale, unused code; this gives no performance overhead, but does make maintaining the code harder and harder.

How do you deal with this?

[edit: added note about deployment being a tough procedure, often]


texts: How to connect panel and translated panel after 'Add translation' node?

texts:
I translate the panel node by selecting Add translation. After doing this, I setup the panel title, layout etc. Press save, but I then end up with two nodes which aren't connected, ie. switching languages doesn't work. Then, going to the translation still shows the 'Add translation' link! This isn't the case for my other content types.

The only way around this at the moment is to manually couple the two translations together by entering the translated node's title in the 'SELECT TRANSLATIONS FOR' autocomplete search field.

Does anybody know how to solve this problem?


texts: Display only taxonomy parents from an entity reference field

texts:
Is there a taxonomy entity reference field formatter to display only taxonomy parents from hierarcherical taxonomy elements ?
Else what could be the way to display, from an entity reference field, only the taxonomy terms parents?


texts: How to filter an already rendered calendar view of a specific date with categories (taxonomy terms)?

texts:
I'm using the latest dev-versions of date/views/calendar/ctools to create an event calendar to display a variety of different events. These events are created with a content-type "event" and classified by a vocabulary (e.g. "movie" or "sport").

I have an already working block of the calendar (showing the current month by default and linking to the corresponding date). If i click on a date i have a list of every event on that date.

How can i reduce the results of that list through the taxonomy terms (movie, sport)?

Any hint or solution is very appreciated...


texts: DS Views Block Field page visibility settings

texts:
I have a Views block Sectors. I have created a DS block field that renders this view and I have configured it to be available only for specific bundle|view_mode. It gets displayed on every bundle|view_mode page after that.

I wan't to configure this block to be visible only on a certain page(s) and not in all bundle|view_mode specified. Basically, I need a Show block on specific pages settings as in D7.


texts: Using Smart IP (or similar) on cached pages

texts:
I would like to use the Smart IP module for IP detection; however, it runs its detection in hook_init(), which does not run on cached pages. I am not married to the module.

I have tried to pull out the guts of the detection and put it into hook_boot(), but there are too many dependencies to do this efficiently. I have it working in hook_exit(), but I am concerned that trying to store the detected country in a session will fail. Also, I would be unable to include the Smart IP'S JavaScript in hook_exit(), since the page is already rendered when it is added.

What are the other ways to get IP detection that sets a session variable on all cached pages?


texts:
I have two content types, provider and products.

The providers is a list of titles filtered by logged in user (each user can only see the providers he enterd). By clicking the provider the user is taken to a page that contains a table with all the provider products.

the provider and the products content type are linked via a unite content field using contextual filter (the mutual field called lpid).

In the products page the path is provider/%/products while the wildcard represents the lpid field.

Everything works great, what I am trying to do is to prevent from users to see other users content.

Is there a way to pass the wildcard via $_POST so the user will not be able manualy change the url?

TNX


texts:
My problem is a priori simple: I would like in a node to refer to the terms of taxonomy that concerns this node, but without "tag" this node, ie: without the node is referenced in the list corresponding to the terms of selected taxonomy.

Indeed, currently, I use an "entity reference" field for "taxonomy terms", and when I refer to a taxonomy term, the node is automatically tagged and appears in the list of nodes related to these terms of taxonomy.

Now, in other words, I would like to "quote", "link", but not "tag".

Example:

I have a node: "Ernest Hemingway", I would like to reference in this node the term taxonomy "The books of Ernest Hemingway", which allows to link / access to all the books of this writer, but for all that, I do not wish the node "Ernest Hemingway" appears in the list "The books of Ernest Hemingway", which is a list of books.

It sounds simple, but I do not find how!

Do you know how to do it?


texts:
The Drupal 8 REST UI configuration page asks me to select Authentication providers for GET method; otherwise, it doesn't allow me to export the REST request.

How can I provide anonymous user to access my REST GET API without providing any auth information?


texts:
I want following functionality when user click on forgot password.

I want user will get an email to rest his password. when he click the link, A new password wil generated and send into his email

Any idea?

Thanks


texts: Why does 'Search Question' of the Answers module not show any results?

texts:
The "Search Questions" view page which is provided by the Answers module does not show any results. I am pasting the typed question as it is yet it just shows "No questions match".

What could be the issue?

Edit: I did get the solution just now, I was trying other related modules Best Answer and Answers Userpoints and after enabling them the Search feature started working. Probably some other module which is mutual between them gets enabled and start working, But I could not figured it out, as the Answers module list was showing all dependency modules enabled prior to all this. Any way it start working.


texts:
Does anybody know of the proper way to debug objects from within hook_cron? I'm trying to set up a task that periodically deletes backups from my private folder, but I can't properly debug arrays that I define in my module. I've tried both the object log and devel debug log modules, but neither of them are properly working for me at the moment, so I feel completely stuck on how to access the information I need.

I've tried running kint() directly, but I'm assuming that doesn't work because it's not running on a page load but in the middle of the cron task.

EDIT: Ended up solving this particular piece of the issue, but am having errors doing some of the deletion as addressed in another issue.


texts: Rewrite the image markup from specific image field

texts:
In a Drupal 7 site, I have an image field that allows unlimited images, called field_gallery_images. I built a template file for this field to create a custom image slider. I want to rewrite the HTML markup for the image to add a lazy-load component. So, instead of:

I want:

Right now, the images are being run through theme_image() and so by the time it gets to the template, the markup is all set. I only want to alter the markup for this one field. I tried theme_preprocess_image(), but that altered all images.


texts: How to use the Rules module to unset all flags (set x days ago) without using Rules Scheduler

texts:
This is a follow-up to my question "How to use the Rules module to unset all flags (set x days ago) when cron runs?".

Case: users set flags on content using Flag module (flags are per user, not global).

Requirement: after a period of time (= x days) the system should automatically unset these flags using Rules module.

Limitation: the Rules Scheduler module cannot be used (for a solution using Rules Scheduler module please see the question linked to above).


texts: Is it safe to connect to another server to send form data?

texts:
I have a standard D7 installation and I was wondering if it's safe to connect to another server to send form data. The way I see it, I'll need to make a page--<path>.tpl.php file and add my PHP at the very top of it. Are there any issues I should know about before doing this? Is this ok to do?

The form is for Anonymous users so no registration is required, it's just that the data needs to be sent elsewhere (another server). Yes, I've tried the Webform module but it's just not what I'm looking for. I'm thinking of using AJAX to send the data.

Any tips/suggestions before I go about this or should I just wing it? :-)


texts:
I have worked out how to use dynamic routing and JsonResponse() in a custom controller to output pure JSON, with no HTML at all. I would like to do the same with an image — for the page to output an image header and the image itself to the browser, with no HTML, as though the address were simply a file path to an image.

Is this possible?


texts:
This is my form to upload a photo

 $form['Background_image'] = array(
 '#type' => 'managed_file',
 '#title' => t('Choose a background image'),
 '#description' => t('Click "Browse..." to select an image to upload.'),
 '#required' => TRUE,
 '#upload_validators' => array('file_validate_extensions' => array('jpeg jpg png gif')),
'#upload_location' => 'public://backgroundimage/',
 '#default_value' => $this->options['Background_image'],

);

I tried this function that get the current uploaded image and return its path, but still not working: what is missing:

function image_path()
  {
   $f = file_load($this->options['Background_image']);
  //this too is not working:
  //$f = file_load($form_state['values']['Background_image']);
   $url_image = file_create_url($f->uri);
   print_r($url_image);
   return ($url_image);
  }


texts: How do I output only CERTAIN submission values in webform HTML mail?

texts:
So here is my problem: In HTML email template, I don't want the user who chose "hotel" to receive the same output values than a user who chose a flight.

I created a booking webform with 30 components with 3 conditional choices (if user chooses hotel, the form looks different than for a user who chooses flight)

My HTML email template looks like this:

Goal of reservation: [submission:values:goal_of_reservation:nolabel]

Name: [site:current-user:field-name]

etc

The Result looks like this:

With my setup, all users receive the same HTML template and I want to avoid that. I want them to receive only the outputs and labels based on their choice of submission.

I thought about adding a if-statement to my HTML template which based on the users choice, the HTML doesn't send certain values. Anyone got a better idea?
Yes webform has an option "Exclude empty values", but that's not exactly what solves my problem.

I don't understand why webform doesn't allow this feature from scratch.


texts: How to programmatically get the field cardinality

texts:
Is there any way to get the number of paragraphs' repeating limit for the entity's field which those paragraphs depends on?

I'm writing a code which creates paragraphs according to the data taken from a CSV data and and insert their target ID (and target revision ID) into user fields programmatically.

The repeating limits of paragraphs for each user field differs.
Some user fields allow paragraphs to repeat only a few times and others expect them to repeat 10 times.

So if my guess was correct it would be useful if I can get the number when collecting data from CSV and that's why I'm asking.


texts: Other users cannot view content published to front page

texts: why can't other users view content posted by user? Where can I find this permission issue?


texts: How to customize the user profile page with views

texts:
I've got a view I want to embed in a user profile page (A list of nodes that are associated with the user). The view is already working correctly.

Is the best way to do this to simply make a region in the theme that shows up only on the user profile page and then add the block view to that region?

To complicate this more, I have some pagination that should work with the view that is in date form (they could click "january 2012" or "february 2012" or just "2012" and is separated from the main view by some other content/markup. Do I somehow make two views? One for the content and the other to manage the links back to the page for which the main view can determine which content to show?


texts: CKEditor and IMCE modules not working fine

texts:
I am having problems trying to integrate IMCE with CKEditor.

I have followed readme.txt instructions from IMCE module but it still not working.

I have set IMCE on File browser type (Link dialog window)
I have tried to take image from server but I get a window with my website inside.

Can anyone help me?

I am working in local with XAMPP on a macbook pro "Sierra". I don't know if it can be helpful

Here some screenshots that may help.


texts:
I have a custom content type with fields in which I collect, among others things, country. I'm using Drupal 8. I'd like to create a grid view page (using Views) of the content that is separated by country like shown in the image.

I'd like to avoid creating mupltiple views, one for each country, and then collating them into yet another page.

Any suggestions on how to make it happen?


texts: Setting a field readonly rather than invisible from hook_field_access()?

texts:
I have a field that should not be visible when editing, in certain cases (depending on node state and user).
It works fine using hook_field_access():

function mymodule_field_access($op, $field, $entity_type, $entity, $account) {
  if ( ...conditions on $entity_type, $entity->type, $field['field_name'], $op...) {
    // → $op=='edit' && isset($entity->nid) so only when modifying existing content
    return FALSE;
  }
  return TRUE;
}

As said it works fine, and the field is not displayed at all when access is not granted.

But in some particular conditions I would like to let the field visible but readonly (grey-ed, or anything preventing to modify it) rather than hiding it.

I tried to return TRUE and before to set according attributes to the field, but until now I failed to make it works as expected. What I tested:

$tmp = mode_load($entity->nid);
$tmp->my_field['#attributes'] = array('readonly' => 'readonly'); // also tried to use 'disabled')
node_save($tmp);

I also tried:

$tmp->my_field['#disabled'] = true;

Thanks for any help.

Regards.


texts: I have created a content Type Student, I have imported the list of student with node import. Now I want to get the name, location and other values of the content type Student from my database. How can I do that with PHP? I have already created a simple module with a menu and block.


texts: how can i add some default text in my datepicker ? I want to add text in the box.


texts: Can I use safe_value when the recommendation is to use a name containing only letters, numbers and spaces?

texts:
Commerce Credits says that the credit name should

  It is recommended that this name begin with a capital letter and contain only letters, number and spaces. This name must be unique.

I am generating a credit name from a profile2 name and a node title and working with the case "John's credit type'.

Clearly the escaped version 'John's credit type' contains characters other than a letter, number or space. So I am using the raw value and getting rid of the other characters. This seems like a relatively untested way of doing things and interferes with the users choice a lot. Is this the best implementation?

Just get rid of raw characters implementation

public function generatePassName($node) {
  $studio_profile = profile2_load_by_user($node->uid, YogaHiveStudioPass::STUDIO_PROFILE_TYPE);
  $studio_profile_name = field_get_items('profile2', $studio_profile, 'field_studio_name', 'value');
  $clean_name = preg_replace("/[^A-Za-z0-9 ]/", '', $studio_profile_name[0]['value']);
  $pass_name = implode(' ', array(
    $clean_name,
    $node->title
));

  return $pass_name;
}

Implementation using Drupal escaping

public function generatePassName($node) {
  $studio_profile = profile2_load_by_user($node->uid, YogaHiveStudioPass::STUDIO_PROFILE_TYPE);
  $studio_profile_name = field_get_items('profile2', $studio_profile, 'field_studio_name', 'value');
  $studio_profile_markup = field_view_value('profile2', $studio_profile, 'field_studio_name', $studio_profile_name[0])
  $pass_name = implode(' ', array(
    $studio_profile_markup['#markup'],
    $node->title
));

  return $pass_name;
}


texts: Old hyperlinks are not accessible after migrating drupal 7

texts:
My old website was located at 127.0.0.1/drupal address. Now I have hosted in live server. The website have content with hyperlinks. See the below screenshot-

All of the content is designed using CKEditor. I noticed that the hyperlinks are not accessible and returns 404 error. As an example; in the above screenshot, whenever I click on hyperlink for eula.pdf, it says file not found (404) error.

Old hyperlink-

http://127.0.0.1/drupal/sites/default/files/docs/pdf/eula.pdf

Hyperlink after migration-

http://www.example.com/drupal/sites/default/files/docs/pdf/eula.pdf

If I manually remove /drupal from the above URL and type http://www.example.com/sites/default/files/docs/pdf/eula.pdf, the file opens successfully.

I have copied all the files from my computer to server. I have also imported the complete database to my new website.

Everything works fine except the hyperlinks, which I have inserted using CKEditor.


texts: Users create a draft (save draft module) but subsequently can't publish node

texts:
Using Drupal 7: users on my site are creating drafts (using the Save Draft module) but subsequently when editing and clicking publish the node never publishes. After clicking publish node remain unpublished and the status remains at 0 in the db node table.

I have also disable the save Draft module but still cannot publish the drafts.

Permissions are all setup correctly.

Very confused. Please help.

Danny.


texts: Im trying to pass an array as an argument in a page callback

texts:
I am attempting to pass an array as a page argument in a page callback in one of my modules. The scenario is this: The user selects some photo prints and I'm trying to add all the selected photo prints to the cart. So I'm trying to pass an array through a url to use it in a function. And the photo prints can be from different photo albums. There is code to do it if all the photos are from the same album so Im currently perusing that as well. This is code I "inherited" by the way.

The URL looks like /add_selected_prints_to_cart/Array. As you can see, instead of an array of values, it's just Array.

This is the page callback:

// Add the selected prints to the cart.
$items['add_selected_prints_to_cart/%'] = array(
  'page callback' => 'add_selected_prints_cart',
  'page arguments' => array(1),
  'access callback' => TRUE,
  'access arguments' => array('view own gallery'),
  'type' => MENU_CALLBACK
);

Like I said, I am just trying to figure out how to pass the array. Once I figure out that, the other part is easy.

Maybe there is an easier way to do this.


texts: How can I pass an array from a controller to a template?

texts:
I want to render array to twig file I am able to render variables but not array.

My php file :

  public function build() {

    $vid = 'Sectors';
    $terms =\Drupal::entityTypeManager()->getStorage('taxonomy_term')-
 >loadTree($vid);
    foreach ($terms as $term) {
     $term_data[] = array(
      'id' => $term->tid,
      'name' => $term->name
     );
    }
    // echo "<pre>";
    //  print_r($term_data);
    //  die;
    // return $vid;

  // do something
    return array(
      '#theme' => 'mdoner_custom_block',
      'title' => 'MDoNER custom Block',
      //'#test' => array('key'=>$term_data),
       'testmenu' => $term_data,
    );

  }

My array:

Array (
       [0] =>
          Array (
               [id] => 1
               [name] => Climate Change
           )
        [1] =>
           Array (
                [id] => 5
                [name] => Ecotourism
          )
    )

.module file:

function mdoner_custom_theme($existing, $type, $theme, $path) {
  return [
    'mdoner_custom_block' => [
      'variables' => ['title' => NULL],
      'test' => array(),
    ],
  ];
}

Twig file:

<!-- dump(content) --> // get array of all the content
{% for key, value in testmenu %}
  Key : {{ key }}
  Value : {{ value }}
{% endfor %}

How can I pass the testmenu variable to twig.


texts: How do I access a function provided by a service resource module?

texts:
Just getting started with Services so this is probably an easy question.

I'm attempting to allow users to access their private messages from a web app using this sandbox module.  At this point, after referring to the documentation on testing resources, I can get a JSON collection of the messages when I visit http://example.com/drupalgap/privatemsg, and I can get a specific thread if I visit http://example.com/drupalgap/privatemsg/threadID.

I understand the basic syntax is example.com + endpoint (drupalgap) + resource (privatemsg) + query.

However, the sandbox module includes a function for getting the number of unread messages, which I would like to do.  Here's the code:

 /**
 * Get the number of unread private messages of the logged-in user.
 *
 * @param int $uid
 *      User ID.
 *
 * @return int
 *   The unread count.
 */
function _privatemsg_services_unread_count($uid = '') {
  global $user;

  if (!user_is_logged_in()) {
    return services_error(t('This user is not logged in.'), 403);
  }

  /*
   * If a user id other than the current user's ID is passed, validate that the
   * authenticated user has the correct permissions to read another user's
   * messages.
   */
  if (is_numeric($uid) && ($uid != $user->uid)) {
    if (user_access("read all private messages")) {
      $account = user_load($uid);
    }
    else {
      return services_error(
        t('This user does not have permissions to use this service.'),
        403
      );
    }
  }
  else {
    $account = $user;
  }

  // Return unread count.
  return privatemsg_unread_count($account);
}

My question is, how do I call this with services?  I've tried things like http://example.com/drupalgap/privatemsg/unread_count/ and http://example.com/drupalgap/privatemsg_unread_count but I get no results.


texts: Is it possible to provide content editor ability to create sortable table?

texts:
I know how to create a sortable table using

theme('table', $headers, $rows)

but is it possible to create a functionality so that a content creator can create a sortable table inside a content.
For example creating a sortable table inside a node.


texts: How to show thumbnail images on product pages using ubercart module?

texts: I recently installed a test of Drupal/Ubercart on one of my test servers. I added a test product and uploaded 3 pictures for the product. My problem is that the 3 pictures are displayed in Full Size on every page that the product is listed. How do I enable thumbnails for these product images? I am quite sure that I have all modules that are required installed, but I see no place to enable thumbnails on product pages.


texts: form_set_error highlights only select fields and not other required field types

texts:
I have a content type with few required fields. When I try to save a node without filling any data, all the required fields throw an error message saying the field is required, but the required fields aren't highlighted in red. Only the select fields are highlighted; date fields or text fields aren't.

This is happening when I use the Zero Point theme (version 7.x-4.10).

How should I proceed with troubleshooting?


texts: Dynamic Phone Numbers / Affiliate Module

texts:
I'm working on a site that has a requirement to have a dynamic phone number in the header.

This number changes when visitors come from another site to the site I' working on.

I've looked around and done plenty of searching on Google but can't find any existing modules that do this, or something similar.

Does anyone know of an existing module for this? or a way I can do it?

Cheers
Chris


texts: Rendering a list with views combining user + a content type

texts:
hello is there any way i can create a view with a list of users who are member of a group [organic group modules, latest version]

The view must also be able to display another content type so Inline ajax comment that i am able to use comments in that content type which is  required in order to use this module Inline ajax comment

The problem that i am facing is this module works when i create a view of content type, but when i create a view of user type it does not work....

Any solution... ?? thanks in advance ...


texts: How to display a form in controller method

texts:
I have a form defined in mymodule/src/Form/myForm.php

namespace Drupal\mymodule\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

class myForm extends FormBase {

/**
 * Specify the form ID.
 */
public function getFormId() {
  return 'mymodule_myform';
}

  /**
   * Build the actual form.
   */
  public function buildForm(array $form, FormStateInterface $form_state) {

    // Form API code here...

Originally, this routing worked fine and the form displayed at the correct path:

mymodule.single_tab:
  path: '/node/{node}/edit/performance'
  defaults:
    _form: '\Drupal\mymodule\Form\myForm'
    _title: 'Add performance'

Then I needed to add a custom access check, restricting to a specific content type:

mymodule.single_tab:
  path: '/node/{node}/edit/performance'
  defaults:
    _title: 'Add performance'
    _controller: '\Drupal\mymodule\Controller\mymoduleController::content'
  requirements:
    _custom_access: '\Drupal\mymodule\Controller\mymoduleController::checkAccess'

The access check works fine. Now I think I have to display my form in the controller:

namespace Drupal\mymodule\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Access\AccessResult;
use Drupal\node\Entity\Node;

/**
 * Controller for Add Performance single tab.
 */
class mymoduleController extends ControllerBase {

  /**
   * Returns the add single performance form.
   */
  public function content() {
    $form = $this->formBuilder->getForm('Drupal\mymodule\Form\myForm');
        return [
          '#type' => 'markup',
          '#markup' => $form
        ];
  }

This fails to display the form, and I get:

Call to a member function getForm() on null

I tried defining my form builder class inside the controller instead, but same result. What am I doing wrong?


texts: How to delete all Drupal content owned by a particular user?

texts:
It seems like there should be a drush command to achieve this, but I cannot find one. I am not clever enough to fashion an SQL query that will delete all nodes owned by a user as well as clean up all the field and revision data.

Please let me know if anyone has any solutions (other than deleting the user's account).

Drupal 7


texts: How to use the Features API to enable a feature?

texts:
So I looked at the features API, and in order to enable a feature, they use this code:

function hook_pre_features_enable_feature($component){
};

So I go in and add this:

function mysite_pre_features_enable_feature($component){
    $component = 'roles';
};

My Feature is already there, but it never gets enabled. Why is this?


texts: Webform validate 18 years old (GNU Date Input Format)

texts:
I'm looking for a valid webform date pattern, to validate a user's birthday (component date).

I want to make sure the person is 18 years of age or older. However, Drupal requires the GNU Date Input Format.

This seems not to work - Drupal shows no error message at all ?

There is also a related answer Field Validation: 18 Years or Older, but this seems to be super complicated and does not affect the webform module.


texts: What would cause CSS to become disabled when performing a database schema update?

texts:
I am running Drupal 7.26 on a GreenGeeks using their EcoSite service.

In addition to Drupal core files I'm using the following modules:

Context
Delta
Webform
ctools
imce
imce_wysiwyg
omega_tools

There are more modules but are very standard like token, views, libraries, pathauto, etc...

I am also using Omega 3 as my base theme. I've created a child theme from it and customized it. Then using Delta + Context created a specifically configured theme for this particular landing page. Also, I am using Drupal's blocks to place content within the Omega themes' regions.

Looking at the Status Report I need to perform Database updates to update certain module database schemas because they are out of date. Those modules are:

system module
7079 - Convert the 'filesize' column in {file_managed} to a bigint.

image module
7005 - Add a column to the 'image_style' table to store administrative labels.

node module
7014 - Add an index on {node}.language.

taxonomy module
7011 - Drop unpublished nodes from the index.

I place my site into maintenance mode and perform the script update. I get no errors. I disable maintenance mode and view my site. Upon viewing my site, all the styling is gone. The page displays the embedded images but no CSS images or any CSS styling.

I reverted my database back to its original configuration. Then I asked for GreenGeeks support for help and they disabled "ModSecurity". I attempted to update my database schema with the same result, my page displays without any styling. They said they couldn't help any further.

To expand on my original question, is there a way to manually update each modules schema one by one to see which is causing this error?

Below is what the site looks like BEFORE making the update

Below is what the site looks like after making the update

Let me know if more information is required.

Thank you for any help, it's appreciated,
Michael.


texts: Check not NULL in entityfieldquery propertyCondition

texts:
I want to only return results in entityfieldquery that have a propertyCondition of 'field_entry_path' that is not empty.

  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'example')
        ->propertyCondition('field_entry_path', '', 'NOT IN');
  $result = $query->execute();

Thanks.


texts: dependent dropdowns via #ajax for unlimited option

texts:
I have a commerce Product content type, which has a field collection field attached to it field_mycollection, which has 4 different fields field1, field2, field3 and field4 dependent on each other. Like field2 will be filled based on field1 selected, field3 will be filled based on field2 selected and field4 is dependent on field3. #ajax is used for this.

My Content
|_ field_mycollection
   |_ field_field1
   |_ field_field2
   |_ field_field3
   |_ field_field4

It is working fine for me for one set of field collection. But I have unlimited option enabled for field collection. It is not working for that.

How could I achieve this goal? I did it using hook_form_FORM_ID_alter().

How to manage edit form ?

My code is :

foreach ($form['field_part_details']['und'] as $key => $fc_mycollection) {
  if (is_numeric($key)) {
    $options_first = custom_get_first_dropdown_options();
    $year = isset($form_state['values']['field_part_details']['und'][$key]['field_year']['und'][$key]['tid']) ? $form_state['values']['field_part_details']['und'][$key]['field_year']['und'][$key]['tid'] : key($options_first);
    $make = isset($form_state['values']['field_part_details']['und'][$key]['field_make']['und'][$key]['tid']) ? $form_state['values']['field_part_details']['und'][$key]['field_make']['und'][$key]['tid'] : '';

    $html_id_first = drupal_html_id('dropdown-first-replace');
    $form['field_part_details']['und'][$key]['field_year']['und']['#ajax'] = array(
      'callback' => 'custom_dependent_dropdown_callback_year',
      'wrapper' => $html_id_first,
    );

    $form['field_part_details']['und'][$key]['field_make']['und']['#options'] = get_second_dropdown_options($year, 'year');
    $form['field_part_details']['und'][$key]['field_model']['und']['#options'] = get_second_dropdown_options($make, 'make');
    $form['field_part_details']['und'][$key]['field_make']['und']['#prefix'] = '
';
    $form['field_part_details']['und'][$key]['field_make']['und']['#suffix'] = '
';

  }
}

Callback Code is :

function custom_dependent_dropdown_callback_year($form, $form_state) {
  return $form['field_part_details']['und'][0]['field_make'];
}

Any help is appreciated.


texts: How to query all content type and add as checkbox for custom form?

texts:
Need help on how to create a custom form that is only available for admins that will query all content types and display the options as a checkbox.

The goal is to only add certain libraries to particular content types selectively through an admin form. How would i query all content types and display them as checkboxes?

What we tried:

mymodule.module

function mymodue_preprocess_node(&$variables) {
  $node = $variables['node'];
  $config = \Drupal::config('mymodule.settings');
  $enabled_content_types = !empty($config->get('enabled_content_types')) ? $config->get('enabled_content_types') : FALSE;

  // This is where we need help.
  if(in_array($enabled_content_type, $node->bundle()) {
    // perform some logic.
  }
}

mymoduleForm.php

<?php

namespace Drupal\mymodule\Form;

class mymoduleForm extends ConfigFormBase {
  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames() {
    return [
      'mymodule.settings',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'mymodule_settings';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $types = \Drupal::entityTypeManager()
      ->getStorage('node_type')
      ->loadMultiple();

    foreach($types as $type) {
      $content_types[$type->id()] = $type->label();
    }

    // Need help setting this up so that the options are content types.
    $form['enabled_content_types'] = [
      '#type' => 'checkbox',
      '#title' => 'Enabled Content Types',
      '#description' => 'Run preprocess for all enabled content types only',
      '#options' => $content_types,
    ],
  }
}


texts: Customized Node Display for 'Document Template' Content-Type

texts:
I want to filter the nodes of content-type Document Template. I know this can be done with .tpl.php files.

I was wondering, what was the right file name convention. I tried the the naming convention but it does not work.

node--document template.tpl.php

Where did I go wrong?


texts:
When users create a node, they should be redirected to a payment page; if payment is successful, the user can see the node.

Is there any way to achieve this?


texts:
i have created a module to hook Drupal cron system and the function in my module is being executed on every cron run, which is perfect.

I need this hooked cron function to run only once weekly without scheduling the default Drupal cron job .
Any help on this ?
Thanks


texts:
So I have a custom table in my drupal database, where each record holds a user id and a tid to indicate a vote.

  id | uid | tid

  17 | 1094630077237307 | 33

I would like to build a view which would display each TID (preferably with taxonomy name instead of just id) together with how many times that particular tid was voted for.
So lets say tid 33 is "Amsterdam" and there are 10 records from different users with tid 33, ideally the view would display:

  Amsterdam: 10

Now, I made my custom table available in views and tried to get this result using aggregation but all I've been able to produce is a view which gives me the amount of tids in the table.


texts: how to filter blog posts by taxonomy and by year

texts:
I have been trying to build a filter fuctionality for blog posts. I would want to filter by taxonomy terms and by the year the post was published. So basically in the content I want to list all blog posts – on sidebar I would have all used taxonomy terms listed and also a list of all years/months when post have been published.

Additionally I want the filter to be reflected by the URL structure:

For a URL like  domain.com/blog/2014 all posts from 2014 would be listed.
For a URL like domain.com/blog/cars only posts tagged with 'car' would be listed.

Is there a module to do this – or should this be done with views? I have been trying to do this with views now but with not much luck. Especially with the url I don't understand how i can do that. Or if there is some tutorials on somewhere – that would help also.


texts: I am going absolutely insane.  I have been up for several hours scouring the internet, installing, removing, installing, removing, and I CANNOT get Drupal (7 or 8) to install at the root of a site (hosted Linux server, not local or vm). If I try to run the drush si with the package outside of the target site's directory structure I get the site-install needs a higher bootstrap error.  Of course, if I move the the install base into the root of the target site's directory, it installs fine...in a subfolder with the name of the install base! I have followed all of the documentation, reviewed hundreds of comments on multiple sites, watched YouTube videos, looked at Pluralsight tutorials.  I am at a loss. I saw suggestions to edit the settings.php file (which the install package creates during the install process and doesn't exist beforehand...). I saw suggestions to rename files that are not yet existant because the install hasn't happened.  I'm sure much of these apply to an upgrade, but not a new site install.  Can anyone please offer some insight into this.  Installing with drush is supposed to make things easier. I have now wasted 4 hours trying to figure this out when I could have just manually installed it. But now it's principle.  I want to know. Besides I might have to do this again for other sites.  Thank you in advance.


texts: Editing article returns "Authored by" to default value

texts:
I changed the default author of a node to blank (' ') for the needs of my project. So, currently when I create a node, "Authored by" field is empty. Then, I could assign author and this works fine - the assigned author is displayed within the Authoring information.

But when I edit the article, the 'Authored by' field is again blank, so if I just want to change something in the body, I would need to assign author again.

Any suggestions how to make the field to remember its value?


texts: How to execute javascript within drupal for a specific field on a specific page?

texts:
The Initil question
I have a input field which should activate a function on the onfocus javascript event on a field on the user page.

Step 1
Add code to a custom module:

(function ($) {
  $(document).ready(totalname(){
    document.getElementById("fullname").style.background = "yellow";
  });
})(jQuery);

The currently HTML is:

<input type="text" id="fullname">

And it should become like this:

<input type="text" id="fullname" onfocus="totalname()">

How to get the onfocus=... inside the input element?
Is the custom code ok?

Addition to this question.

Thxs you so much for all the comments. Based on that I learned i few things more so I now understand what the real question should be.

To understand how I can executed javascript code in a certain field on a certain page in drupal.

I assumed this was needed by a callback but this is not encoured according to @Jimmy so I'm trying to understand the way it should be according to drupal standards. Also I was suprised that no change in HTML was needed as @Adrian gave an example. I could not get it run because of the typo :-( So in mean time I made another solution.

The  script is basicly just a real time concatination of first, middle and last name into a fullname field.

(function ($) {
  $(document).ready(function(){

        function setFullName() {
            var nameParts = [document.getElementById("edit-field-voornaam-und-0-value").value,
                             document.getElementById("edit-field-tussenvoegsel-und-0-value").value,
                             document.getElementById("edit-field-achternaam-und-0-value").value],
                name = nameParts.join(" ").trim();

            document.getElementById("edit-field-naam-und-0-value").value = name;
        }

        var fields = [document.getElementById('edit-field-voornaam-und-0-value'),
                      document.getElementById('edit-field-tussenvoegsel-und-0-value'),
                      document.getElementById('edit-field-achternaam-und-0-value')];

        for (var i = 0; i < fields.length; i++) {
            fields[i].addEventListener("keyup", setFullName);
        }

  });
})(jQuery);

So this is working and I put it in a custom module.

I still do not understand how I should be if I rewrite the code following the example of @adrian as this code is still executed on every page and not a specific page.

Thank you for learning !! and not using the correct words. I'm not native english ...


texts: Display taxonomy terms on search results page (D8)

texts:
I'm building a site for a client and they would like to have a search results page that displays taxonomy terms on matched search results.

I've created a custom theme and was editing templates/dataset/item-list.html.twig to get this data to display.

I also created:

function my_template_preprocess_item_list(&$variables)
{
    foreach ($variables['items'] as $item) {
        // do something here
    }
}

But I'm not sure what I should be doing here. Ideally, what I would like to do is have a section on the search results page that displays the matched taxonomy terms and the number of times each term appears in the search results.

Tomorrow's problem is making those taxonomy terms into links that further filters the search results.

I'm running drupal 8.


texts: Ajax error and weird white space when connected

texts:
When connected in Drupal (the problem does NOT happen when logged out), I see a strange � character.

The character seem to break Ajax calls all over the admin (I get an alert, with code 200, and the result of the Ajax request). I get the error when editing views, adding some contents, etc. Anything that requires Ajax.

The character also appears on every pages of the website, but only if I'm logged in Drupal. Otherwise, it doesn't appear.

I figured, the problem can't be in a file, or it would happen when I'm logged out too ?

Is there some files that are only called when logged in ?

Thanks !


texts:
I'm having some trouble with removing the active language from the Language Switcher Dropdown module. I'm trying to override theme_languageicons_icon() with the following code, but it doesn't seem to work.

function themename_languageicons_icon(&$variables) {
  global $language;

  foreach ($variables as $varKey => $value) {
    if ($variables['language']->language == $language->language) {
      unset($variables[$varKey]);
      break;
    }
  }

  return theme('links', $variables);
}

Do you have any idea on how to achieve this? I don't want to disable the active language using CSS since I'm having different style properties for the first-child and last-child of the list.


texts: How to pass contextual filters in customer profile empty text?

texts: I have a view displaying customer profiles. It takes 2 contextual filters : the user id and the type of the customer profile (billing/shipping). I want to add a no results behaviour, the "Commerce customer profile : Empty text". I filled in the field "Path to a customer profile add form" with something like /user/%/addressbook/%/create in order to have the % replaced with the contextual filters but it doesn't work. When I click on the link, I get the page "/user/%25/addressbook/%25/create" not found. I tried many things but in vain... Isn't this the way to pass contextual filters ? Thanks for your help !


texts: Hitting a download link and displaying text in the same menu item page callback (7)

texts:
I have a menu item for one of my content types that I want to be able to package up some different files, create a .zip file, link to start a download and then display some text which will describe what the user needs to do with the .zip file.

Here is my menu declaration:

        'title' => 'Download Icon',
        'description' => 'Package up the selected icon as a zip file and download it',
        'page callback' => 'download_icon_page_callback',
        'page arguments' => array(1),
        'access callback' => 'download_icon_access',
        'access arguments' => array(1),
        'type' => MENU_LOCAL_TASK,
        ),

And here is my page callback that doesn't work for obvious reason:

function download_icon_page_callback()
{
    // some code to compile my .zip file
    drupal_goto('path/to/my/file.zip');
    return t('Here are some inustrctions!');
}

So this above function can link to the file compiled .zip with a drupal_goto but since this a redirect the return t will not ever go through.  Is there anyway I can hit both of these in a single page callback?  Also, is there a better way to display formatted text from the menu item instead of just doing a return t() from my page callback?


texts: Remove Admin Toolbar "Manage" item if User has No Access

texts:
I have created Tours for my users and allowed them to see the Admin Toolbar as a result. However, I have the following unpleasant toolbar:

I would like the "Manage" item to be gone altogether when there's only the Logout & Home link. How could I achieve such behavior?

Note: I've tried disabling the Tools item in the Administrative menu UI and that kinda works, but the Manage item is still displayed.


texts: How do I hide a field from a Profile2 form without deleting it?

texts:
I have a field in a Profile2 form. I'm trying to streamline the signup process and not ask for users' phone numbers. However, I don't want to delete the phone numbers of users who have already inputted the field, so I don't want to delete the field.

How do I hide the field from the form, without deleting it, and having the ability to unhide it if I decide to do that later (or ask for the information at a later time, after initial signup)?


texts: Date module not showing Text with Date Popup widget

texts: I have enabled Date Module completely. But when I try to add Date field to my custom content type the widget has only two options "Text Filed" and "Popup Calendar". There is no third option "Text Field with Date Popup Calender"?


texts: Views3 date field (filter) treated as string

texts:
I am used to getting int operators(like less then) in views when using date api fields but now I'm getting string operators so I can't filter on dates(like now).
When creating a filter on 'post date' for ex. it works just as usual.
It actually just looks like when you turn off date views.

It's a drupal 7 installation with views3 and the latest date api.

I don't know what went wrong or this is a bug but I can't seem to fix it.


texts: Grouping content by taxonomy, multiple taxonomies by node

texts:
Note: The solution should not change the main Views properties, mainly that it is a View of content nodes.

I have a content type (books) which are under a taxonomy (Category). I have created a View to show the titles. By using "Grouping field" with the category (see picture #1), I can get the title of the category and order by that.

However, when I have books which are classified under several Categories (in this example, the book about Chess is under Sports and Science), I get a mixture of taxonomies in the Grouping field displayed, and the book does not appear in the other categories. I would like it to appear under Sports and under Sciende, and get rid of this "third" combined taxonomy "Science, Sports". (see picture #2).

Image 1

Image 2


texts: Where do i start when trying to get webservice API's integrated?

texts:
I am building a travel website for a client, and we need search form tied to different API's and in some cases combined API's returning results.

I am a seasoned PHP developer, but fairly new to Drupal.

Where should I start? what modules should i be looking at?

Any help would be great.


texts:
When a user visits the homepage of our site I'd like to display a message, but only display it if they haven't viewed a particular (other) node yet. I can't find any data selector in the Rules module that allows me to specify the values from any node other than the current node. How should I do this?

In other words, I'd like to create a rule that evaluates the value in a particular node (one that can be directly identified like node/100) in its conditions. I can't seem to figure it out.

I'm using Drupal 7, and Rules 7.x-2.7


texts: Round Commerce Price: in tpl.php or template.php

texts:
Currently I'm using Commerce and Commerce Multicurrency to our currency in Indonesia.

Sometimes there is a price to numbers that are not rounded.

With print render ($ content ['product: commerce_price']) I get the original price.

I've tried to edit the tpl.php file and the results are as desired.

number_format (round ($ price, -4), 0);

2,511,000 into 2,500,000
2,565,000 into 2,600,000

But after some reading and hopefully not misread. That is not good in tpl.php, but should be in template.php or modules.

Please advise to help me.


texts:
Fatal error: Class 'Drupal\module_name\DOMDocument' not found in
  /var/www/drupal/modules/module_name/src/form_xml.php on line 359

Any idea why Drupal cannot find DOMDocument class?

I want to execute a code when a form is submitted

  public function submitForm(array &$form, FormStateInterface $form_state) {
    // Find out what was submitted.
    $form_field = $form_state->getValue('content_types');

    foreach ($form_field as $key => $value){
      if (!empty($value)){
        $return = File::generate();
      }
    }
  }

In case you are wondering, module_name is the name of my custom module.

File::generate() is a static method which contains the DOMDocument class

The code works fine when I use devel to execute it, so any idea why can't it find the DOMDocument class on form submit?

Seems to me as if the form blocks access to the DOMDocument class.


texts: Is Windows XP and XAMPP able to render complex development sites in Drupal 7?

texts: I am developing a site, and in the Linux server it goes very fast, with peaks of memory of 40 MBytes, according to Devel module. However, when I test it exactly the same in Windows XP and Xampp, it takes a long time to serve each page, even if the memory usage is a little less - (25 Mb !? ). When Drupal 7 is freshly installed, with default configuration, it is very fast, but when I add modules, etc., it takes ages to load any page, even if the memory usage is low as I said. Memory limit of PHP is 128 Megabytes.


texts: module_load_include loads file but also prints path to the file

texts:
I am using the api function module_load_include to include some markup in a custom module. The markup gets included and I indeed see it on my page but I am getting a side effect that the path to the include file also prints on the page along with my markup. Here is what I have that's working but with the unwanted path being printed out.

function mymodule_page_build(&$page) {

  if (!path_is_admin(current_path())) {
    $page['page_top']['mymodule'] = array(
      '#type' => 'markup',
      '#weight' => 25,
      '#markup' => check_plain(module_load_include('inc', 'mymodule', 'inc/markup')),
    );
  }

}

so the markup from my include file renders as HTML but I also see this on the page as well.

/sites/all/modules/custom/mymodule/inc/markup.inc

Just not sure what I am doing wrong, could not find any examples where this api function is used to include within the #markup context.


texts: Is there a way to change the user permissions of a content type? As I would not like the anonymous user to access a specific content type.


texts: How to hide /node/ , /taxonomy/, /mymodule/, etc., from the URL path

texts: I have the module Path auto installed. I would like that the user could not access the content by the URL http://www.myexample.com/node/7 and instead would have to follow the menu and other webpage links with its alias. So if I forgot to set an alias for a content, I will be redirected to 404 or home page. The goal is to protect the "real" URLs which Drupal generates when creating content via admin and modules.


texts: HybridAuth has stopped working with FaceBook

texts:
Before the weekend, I successfully set up the HybridAuth module. Upon returning to this project this week (July 1), Facebook logins no longer seem to respond.

Watchdog logs contained numerous of the following lines

Exception: Authentication failed! Facebook returned an invalid user id. in Hybrid_Auth::initialize() (line 147 of xxxxxxxx/public_html/sites/all/libraries/hybridauth/hybridauth/Hybrid/Auth.php).

Now I have checked the FB AppID and AppSecret. They are correct.

Permission is set as follows....

Sand box is off

I'm using the latest library from HybridAuth. I've clone it using git


texts: Render a custom region inside node template

texts:
I am attempting to render a menu assigned to a block right next to the body of a custom content type. I am using Drupal 7.

I have a custom region defined within my template .info file. I would like to render this region and the block assigned to it from within a custom node template ...

node--<my custom content type>.tpl.php

I needed to do this within the custom node template because I needed to break out the individual fields of the content type rather than just using

print render($content);

This is what I was trying to do ...

  <?php
    print render($content['title']);
    print render($content['field_banner_image']);
    print render($content['body']);
  ?>

<?php print render($page['MY-CUSTOM-REGION']); ?>

<?php print render($content['body']); ?>div>

However, my menu block does not render and I get the following error ...

Warning: Cannot use a scalar value as an array in include()[PATH TO MY CUSTOM NODE TEMPLATE]

Is it possible to render a region from within a custom node template?


texts: How to install Social Auth LinkedIn PHP Library with composer for Open Social Drupal module?

texts:
How to install Social Auth LinkedIn PHP Library with composer for Open Social Drupal module ?

I try to install Open Social (https://www.drupal.org/project/social) but I can't because I can find how to install the LinkedIn library with Composer.

I already installed successfully Google, Facebook and Twitter library with Composer.

"Social Auth LinkedIn module requirements
Not installed
Social Auth LinkedIn requires LinkedIn PHP Library. Make sure the library is installed via Composer."

Thanks.


texts: How can I show a view in panel with argument in drupal 7

texts: I am using panel to show the content and i am using view.I am creating a forum and want the link based upon argument when i am creating view and giving some context ,in preview it is working fine but when i am trying to rum wirh url no value is coming can any one tell what I am doing wrong.thanks in advance.


texts: views exposed filters - return user selection or another value

texts:
I have a content type with multiple fields and a view to display them. I have an exposed filter for one of the fields and want to achieve this functionality:

when a user select a value for this filter I want to return those nodes but also the ones that have a certain value on another field.

Is there any way I can achieve that from the interface? I know how to do it with hook_views_query_alter()

Thanks


texts: When confirming installation of modules, I get a server error (500)

texts:
I setup my D7 websites using MAMP and since a while I failed to activate modules... Whenever I save certain modules, I get a 500-error.

I don't think it has something to do with a memory_limit since the error appears almost instant...

I already tried to increase the permissions (777) on the sites folder, but no luck there.

This is what my apache_error.log says:

Any advice?


texts: How to find and delete nodes with duplicate titles?

texts:
I used Feeds, and for some reason it imported several nodes multiple times; now I have many duplicates.

How could I easily find and delete such nodes?


texts:
I know that this isn't a really big priority but with the default Drupal menu you get css classes like .first or .last or .active.

.first and .last are being provided by CSS3 and .active only needs to be on the <a> link not on the <li> due to the way my CSS works.

All these classes are unneeded and I'd like to remove them, so I can create a clean and efficient template.

Does anyone have any ideas how to do this (and if possible provide a small code sample)?

Thanks :)


texts: Populate taxonomy page with blocks of content from other taxonomy vocabularies

texts:
I would like to create a page that holds two blocks of content. One would be a view-block showing a list from content type A and the other a view-block showing a list from content type B. The caveat is that the content type lists show information that has been specifically tagged with a specific location and the page itself is auto-populated based on taxonomy for that location.

(For example, mysite.com/states/oregon would display blog posts for Oregon as well as resources for Oregon.)

The two content types have their own taxonomy vocabulary for a state list content A taxonomy and content B taxonomy and a third state taxonomy list for the state pages, taxonomy C. I think this might be a problem...

Do I need to use one taxonomy vocabulary for each of these content types in order to create a taxonomy page that can populate two blocks of content tagged by the taxonomy terms; (this is less ideal for my situation at the moment)
or is there a way I can build a view block using contextual filters to call forth the different vocabularies in order to populate tagged content for each content's taxonomy vocabulary? If I can accomplish the latter, then I'm hoping I can just assign the block to the content area of the taxonomy C page as per usual.

Bonus: I'm already using a taxonomy view to control the appearance and behavior of my taxonomy pages.


texts:
I have a form that generates some custom financial reports (can't use Views).  It has some typical form elements, a table of results, and three submit buttons: Submit, Reset, and Download.

Submit and Reset do what you think. Download triggers a submit handler that builds a CSV from the $form['table'] in the handler (which is what the user has generated, and prevents another complicated database query + computations and another route to essentially do the same work), and then spits it out with a $form_state->setResponse($response).  This works great.

I discovered an interesting edge case, though, during testing.

core/misc/form.es6.js has a section of code in it (lines 117-134 in Drupal 8.8.5):

Drupal.behaviors.formSingleSubmit = {
  attach() {
    function onFormSubmit(e) {
      const $form = $(e.currentTarget);
      const formValues = $form.serialize();
      const previousValues = $form.attr('data-drupal-form-submit-last');
      if (previousValues === formValues) {
        e.preventDefault();
      } else {
        $form.attr('data-drupal-form-submit-last', formValues);
      }
    }

    $('body')
      .once('form-single-submit')
      .on('submit.singleSubmit', 'form:not([method~="GET"])', onFormSubmit);
  },
};

This prevents a form from being submitted more than once if it hasn't changed.  However, since my Download button is a submit handler, the above code runs, which then prevents the Reset button from working unless another form element has been changed.

My current workaround is a bit of a sledgehammer:

Drupal.behaviors.sledgehammer = {
  attach: function (context, settings) {
    $('form.my-form', context).on('submit', function (e) {
      var $form = $(e.currentTarget);
      $form.removeAttr('data-drupal-form-submit-last');
    });
  }
};

As far as I can tell this works, but I have BigPipe turned on and am going to AJAX up the form a bit, so I am worried that this may be fragile.

Is there an JS API way to disable the single-submit behavior, or is a workaround the only solution?


texts: Display a Quicktab content in Colorbox pop-up Drupal 6

texts:
I have a quick tab (Drupal 6) which contains three tabs. One of it has a table which is larger in size. Hence, when the third tab was clicked I need to show the third table as a Popup using Colorbox.

I have that table as a node Page and I want to display that node as a Popup.


texts: Adding content type field value to a taxonomy term?

texts:
What I'm trying to say at the title is, I have this Select List field that gets its values from a taxonomy called "Thing".

The taxonomy term are (Thing-1,Thing-2,Other).
When "Other" is selected a text field called "Specify" will appear. What I'm trying to do is when the user submits the form. Whatever he placed on the "Specify" field will be added as a "Thing" Taxonomy term.

So the terms will be (Thing-1,Thing-2,New Thing,Other).

I might be over explaining this, but I can't find anything on google.


texts:
Does anyone know if there is a way to use Feeds to import into Entityforms?
 I have a CSV file of usernames and spent some hours at a specific event and would like to import it into it's corresponding form rather than entering it in all by hand.
How can I import Data from CSV file into EntityForm`?


texts: Subtheme media query CSS in Omega Kickstart subtheme

texts:
I want to build a site based off of Omega Kickstart which is a subtheme of Omega.  Of course I want to layer in my changes sparsely so I made a subtheme of Omega Kickstart.

All the guides out there for doing this assume that you only want one global CSS file in your new subtheme.  That seems crazy to me -- I want to follow the same mobile-first pattern in my subtheme and individually override each targeted CSS file i.e. alpha-default.css, alpha-default-narrow.css, etc...

Is this possible?  To have both omega-kickstart-alpha-default.css and MYTHEME-alpha-default.css?

Everything I try seems to want to override omega-kickstart*.css with MYTHEME*.css.  And it seems to defeat the whole purpose of subtheming to copy omega-kickstart*.css over to MYTHEME*.css.


texts:
I have the Views Ctools Field module installed.
I am getting below errors:

Notice: Undefined index: id in views_ctools_field_views_data() (line 66 of /var/www/html/drupal/sites/all/modules/views_ctools_field/views_ctools_field.views.inc).
Notice: Undefined index: key in views_ctools_field_views_data() (line 67 of /var/www/html/drupal/sites/all/modules/views_ctools_field/views_ctools_field.views.inc).
Notice: Undefined index: id in views_ctools_field_views_data() (line 66 of /var/www/html/drupal/sites/all/modules/views_ctools_field/views_ctools_field.views.inc).
Notice: Undefined index: key in views_ctools_field_views_data() (line 67 of /var/www/html/drupal/sites/all/modules/views_ctools_field/views_ctools_field.views.inc).

EDIT:

Actually this module is installed by others in production site.

I am theming a views table for a specific content type.Its working fine. I thought these errors are because of the view table theming which I have created.
But these are occuring while clearing the cache also.
But when we referesh the page these errors could not be seen again.

I am also using custom module to hide some fields using hook_form_alter and set the values using hook_node_presave and the custom module is also working fine.

I am not using views ctool field.

Not able to understand why these errors are occurring.

What can be done to remove these notices?

Any help is appreciated.


texts: Drupal 7 Views : Filter Event : only show events when start date <= start date + 3 weeks

texts:
I have a list of Upcoming Events that shows all events in chronological order starting with Today. Most events last only a week or two at most, but we also have exhibitions that run for 3-4 months. They end up at the top of the list the whole time, with more immediate events below them, so I want all events to appear only for the first three weeks after the Start Date.

The Filter Criteria in Views allows you to state a date relative to Now, TODAY, Monday, or a specific date, but I cannot figure out how to make a filter that is relative to the Start Date itself.


texts:
My log is cluttered with this message:

Warning: Cannot modify header information - headers already sent by (output started at /home/path/to/drupal/7/includes/common.inc:2681) in drupal_send_headers() (line 1216 of /home/path/to/drupal/7/includes/bootstrap.inc).

It occurrs only when someone types address to a non-existing comment like this:

http://example.com/comment/874

If the comment exists, or for any other address, there is no error. (I was deleting lots of spam comments recently and the bots keep coming back to read their own comments, that's why there is a lot of not found comments.)

Is there any means to get rid of this error? The only comment module I have is Comment Goodness and there isn't complaint on such error in the issue queue, so maybe it's something else. I checked all my custom module files and each of them starts with <?php and there is no space or anything before this tag, and there is no closing tag. I have no idea what else to check.


texts: Linked images from the Media module in WYSIWYG having A tags stripped when rendered to template

texts:
I am using the WYSIWYG module to load TinyMCE 4.x, I am then uploading an image via the Media button in the toolbar of TinyMCE finally I am using LinkIt to link the image to a location.

All of this is fine inside the WYSIWYG editor, but once it is published and viewed on the page the wrapping  tag is stripped.

So in the editor if I view the source I see:

    [[{"fid":"7","view_mode":"default","fields":{"format":"default","field_file_image_alt_text[und][0][value]":"","field_file_image_title_text[und][0][value]":""},"type":"media","link_text":null,"attributes":{"height":376,"width":640,"class":"media-element file-default"}}]]

However once this is rendered to the template I see simply:

If I then edit this piece of content again and view the source of the WYSIWYG editor the  tag is definitely still wrapped around the Media module's little string of JSON.

In a bid to prevent this from happening I changed the Wysiwyg Profiles and Text Profiles so that they don't remove broken tags or attempt to clean up an HTML or introduce any of their own HTML. Unfortunately this has had no effect.

Is there some way that Media/Drupal/WYSIWYG/LinkIt can be setup so that it will allow images to be linked? I have been unable to find a relevant issue or patch floating about out there on the web either.


texts: Loading css style present in DOM of another node

texts:
I am using the module Simple Background Image Formatter to convert an image into a div background image. It has two options - one to put as an inline style of a div or to choose a CSS selector which it styles with a background image in the DOM.
I cannot use the inline style method in views so that is ruled out. Now as per the CSS selector method, it adds a style directly on the page with the 'selectedclass_id'. I can choose the selectedclass but not the id (appears to be randomly added).

However, since my requirement is through views, it somehow (although with wierd settings) automatically prints the class and adds the id, however, the image for other nodes is not loaded in this node as its html style in not loaded in the current page. That is, the image of every page is converted into a
selectedclass_id (background-image:...) and placed in the html of that page but the selectedclass_id of the other nodes which are part of the view in this page are not loaded here with their respective values. Therefore, these images are not being displayed in the view.

Is there a solution here? I want the page to load the css selectors for the nodes which are shown in the view (of the same content type) so that the code for each of the view fields is  where the id will be different for each of the nodes. The current page should have the values of all such nodes in the view as it does with regard the value of the current page. Presently, only the selectedclass_id of the current page is being loaded in the head html style.

An alternative for the module is Background Images Formatter but this is dependent on bg_image which does not have a Drupal 8 version and doesn't work without it.


texts: How to include Facebook feeds inside my page?

texts:
I want to include Facebook feeds from my Facebook page to my Drupal site as a block.
How to do that?


texts:
I'm trying to use the [current-page:url] token in a webform hidden field (as the default value) but the submission shows "[current-page:url]" literally.
Am I missing something?


texts: Migrating a huge live drupal 6 site to drupal 7 Server

texts:
I am having a drupal 6 based news site with almost 600 thousand nodes. We are currently building a new site on drupal7.

What are the ways to migrate the content from old to new?
What are the best practices?
What are the know issues?
Can data be migrated in chunks?

I did alot of reading online, didn't find anything to give me confidence. Hopefully there will be people here who have hands on experience in this.


texts: How to calculate the sum of 2 fields in a content type and display the result in a 3rd one when the node is saved?

texts:
Could anybody figure out to me how i could create a field that computes the sum of values in 2 other fields.

In other words how to do a simple addition (say of price and vat) like so:

price
+
vat
======
result

The result should be displayd after the editor saved the node.


texts: How can I require a custom module hosted elsewhere with its contrib dependencies being downloaded too?

texts:
Hi I am trying to setup my new Drupal 8 site with composer, but I got few issues.
I tried to setup the site site by following the Guide from here and was able to setup the site successfully.
After that I tried to install a custom module which is hosted on Bitbucket and I am able to download the package using Composer, but the problem is the module has some other contributed module dependency but the dependency module is not downloaded along with the custom module.
I followed the guide from here and added composer.json file to my custom module along with the dependency, but after running composer require custom/custom_module only the custom module is installed but not the dependency.
My root directory composer.json file repositories section looks like this.
"repositories": [
    {
        "type": "composer",
        "url": "https://packages.drupal.org/8"
    },
    {
      "type": "package",
      "package": {
        "name": "custom/custom_module",
        "version": "master",
        "type": "drupal-custom-module",
        "source": {
          "type": "git",
          "url": "git@bitbucket.org:username/custom-module.git",
          "reference": "master"
        }
      }
    }
],

The composer.json file from the custom module is the following.
{
    "name": "custom/custom_module",
    "description": "This is a Custom Module with Different functionalities.",
    "type": "drupal-custom-module",
    "minimum-stability": "dev",
    "require": {
        "drupal/restui": "~1.16"
    }
}

I also chaged the line "drupal/restui": "~1.16" as "drupal/restui": "^1.16" but with no success.
I even tried running composer update in the custom module directory as I was not sure whether dependencies will be installed along with custom module.
After running composer update in the custom module directory I got this error.

Your requirements could not be resolved to an installable set of packages.

Problem 1

The requested package drupal/restui could not be found in any version, there may be a typo in the package name.

Potential causes:

A typo in the package name
The package is not available in a stable-enough version according to your minimum-stability setting
see https://getcomposer.org/doc/04-schema.md#minimum-stability for more details.
It's a private package and you forgot to add a custom repository to find it

Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

On Drupal.org I can find the module with that version here.
EDIT 1
I have added below to the composer.json file from the custom module but still same issue.
"repositories": [
  {
    "type": "composer",
    "url": "https://packages.drupal.org/8"
  }
],

EDIT 2 : Seems recursive package download is not possible with composer. Refer Why can't Composer load repositories recursively? and Add support for installing libraries via asset-packagist