texts: D8 - How to modify url params on form submit?

texts:
Im using form_alter on a views exposed filter form. There are 2 date fields (start-date and end-date) which are exposed filters that Ive hidden from the user. I want to populate the url argument of these 2 fields when the form is submitted.

Ive tried both methods using a submit and validation callback but neither seems to work.

My form_alter is:

function mymodule_form_views_exposed_form_alter(&$form,
  FormStateInterface $form_state, $form_id) {
    if ($form['#id'] == 'views-exposed-form-my-form-id') {
  ...
  ...

  $form['#submit'][] = '_my_custom_submit';
  $form['#validate'][] = '_my_custom_validate';
}

My callback looks like:

function _my_custom_validate($form, FormStateInterface $form_state) {

  // Pass date range selection to date fields.
  $date_range = $form_state->getValue('date-range');
  $date_range_split = explode(":", $date_range, 2);
  $start_date = $date_range_split[0];
  $end_date = $date_range_split[1];

  $form_state->setValue('start-date', $start_date);
  $form_state->setValue('end-date', $end_date);

  $input = &$form_state->getUserInput();
  $input['start-date'] = $start_date;
  $input['end-date'] = $start_date;
  $form_state->setUserInput($input);
}

When I dpm() any of my vars above I see the data but I can not get it passed into the url's arg on submit so I keep getting http://domain.com&start-date=&end-date=

How can I populate/modify the url args after the user clicks submit but before the page reloads?

If theres any other info that I can provide that may be helpful, please let me know.

Thanks!


texts: Node title get deleted when saving a translation of the node

texts:
Not sure if this is issue of the Title module which I have enabled, or just a bad configuration.

To reproduce:

1- Create a content type: My content and checked Enabled, with translation

2- Create a english node with title: My english node title. Save

3- Create a translation for that node to french with title:  My french node title. Save

4- Now(after I saved the french node) if I go to edit the english node the title field is empty

It happens in the other way too. If I edit and save the english node and then I go to edit the french node the title field is empty

How can I trace this? It seems a bug to me, but not sure.


texts:
When I enable core forum module it does not automatically create "Forums" vocabulary in taxonomy and it uses another vocabulary instead.

I've tried to create Forums vocabulary manually and then assign it to 'Forum topic' content type from 'manage fields' tab like so:

but it still uses another vocabulary. I've tried everything that I found.

Note: The forum lists its topics from 'Service Types' vocabulary, even though I configured it to use Forums as I described above. I think the main problem here is that when I enable forum module it should automatically create the 'Forums' vocabulary, but for some reason it does not do it.


texts: How to import/sync comments from Disqus into my drupal database?

texts:
After reading the module´s homepage, I understand that there´s an easy way to get disquss comments easily imported/exported from your Drupal database in D7.

  To import/sync: You can do a one-time import at Comments->Disqus
  Import. Specify the timestamp you want to import from. You can have
  comments automatically import from Disqus on an interval basis. Turn
  this on in the import settings at Site Config -> Disqus -> Import.
  Turning on syncing will query Disqus for any comments that came in
  since the last import.

But how do I actually do that?

I don´t have any "Disquss import" tab or link under "admin/content/comment"

And under "/admin/config/services/disqus" I don´t have any "Import" link or tab.
Maybe I´m missing something?

Thanks for your help!!
Rosamunda


texts: How to set a value on a field collection using entity metadata wrapper

texts:
I'm trying to programmatically set a value on a field collection item attached to the user entity.

The field collection field in question is titled, field_user_location.

I initially had this ($usr_wrapper being an entity metadata wrapper of the user entity)

$usr_wrapper->field_user_location->field_land_phone->set($object['Phone Number']);

However that doesn't appear to work.

How do you get data onto a field collection via entity_metadata_wrapper()? There isn't much documentation about how to do this that I am seeing.


texts:
I need to create checklist form(s) comprising of a different sets of checks with different ways to enter an answer. The end user (who will prepare checklist) should not need to add fields to the structure or do any other background tasks.

I created new content type called "checklist" with some fields:

ChecklistText
AnswerOptions
Comments

For example
Item A:

ChecklistText : "Fuel Consumption"
AnswerOptions : "Liters|Int"
Comments : "Yes"

Item B:

ChecklistText : "Engine checked"
AnswerOptions : "YesNo|Logical,Name|Text"
Comments : "No"

From that data I would need to render a form. Starting with Item A it should display ChecklistText , entry field Liters and entry field comments. Form should then continue with item B and display ChecklistText , checkbox with field to enter name of the person who checked it (or none if it wasn't checked) and no comment field. At the end a submit button.

My idea how to proceed from here on would be : write a custom module to create a form from content. Parse the field AnswerOption to put correct elements on the form , name elements with an ID (from content record) prefix as to not get duplicates and then somehow submit all that. Is this possible at all with existing drupal functions ?

Was searching for similar examples , but the absence of them got me thinking that my approach to this task is totally off the mark ?

Using D7. Very new to Drupal & PHP , but coding since the age of dinosaurs. Hence my approach as a database desktop programmer.


texts: How can I create page.tpl for user’s profile page?

texts:
Searching in Google I found user-profile.tpl.php , but in fact this is the node of profile page while I want to create page.tpl.php foe the profile page.
Also page-user.tpl.php includes login page, register page and all the pages belong to a user which I do not consider, I need to create page.tpl for profile page


texts: views exposed filters : how to trigger the submit on options click

texts:
How to trigger the submit on select options click?

This would require for the end-user one click instead of two.
The button could be removed or hide.


texts:
How do I change the width in the Bartik theme (or better yet, allow it to adjust for different browser sizes)?

I've been trying to link to my drupal site via a Facebook page, and the default width is too large.

I've also downloaded the Bartik-Facebook subtheme, which made the width small enough for facebook, but also removed scrollbars, so that large pages were cut off and could not be scrolled down to.

I'd like the width to be smaller, but still allow scrollbars if the page has too much content.

I haven't yet done any coding regarding modules/themes, so a solution that is simply downloading a module/theme would be preferred, but if developing my own theme/module is the only way, I'm prepared to have a go at that.


texts: I want to change the label shown to export csv file download link that generated with data export of a view. I didn't get any setting to change the label of download link - download full list.


texts:
How do I achieve the following in Drupal:

[MY BLOCK HERE]

[MY BLOCK HERE]

[MY BLOCK HERE]

I can use the "Block Class" module to assign the grid system classes to the block, however this does not allow me reuse blocks in another layout (changing the grid system classes).

Im also limited to where I can put these blocks. At the moment i have a specific region setup that is wrapped in the "row" class. This prevents me for having a few different rows and from placing the blocks anywhere...

[MY BLOCK HERE]

[MY BLOCK HERE]

[MY BLOCK HERE]

[MY BLOCK HERE]

[MY BLOCK HERE]

[MY BLOCK HERE]

Basically I need to:

Add grid system classes to blocks
Reuse blocks in a different grid system class configuration
Freedom to define rows of blocks and assign them to any region, not just one that is wrapped in a single "row" class.

Any help would be much appreciated, at the moment I have to style each individual block to work responsively and I know that there must be a better way of doing this.

Thanks


texts: How can I track statistics regarding the number of sign-ups vs. account deletions?

texts:
I'm working on a social networking site in Drupal 7 that I haven't launched yet.  However, once I've launched I would like some basic metrics to track how I'm doing, particularly the number of sign-ups per week (or some other arbitrary interval) and the number of users who have cancelled/deleted their accounts.

Is there a way to track this from within Drupal?


texts:
I am trying to show a multiple node reference input control that shows the title and an image of each node.

I have achieved it using Autocomplete Deluxe but it allows users to create new objects in the control itself which I cannot allow. I have also tried Chosen with a reference view but it strips all HTML before showing in the list.

Are there any other modules or techniques I could try to achieve this?


texts: Build menu based in Vocabulary (Taxonomy)?

texts:
I just follow this tutorial to build a menu based in the tags vocabulary. Everything is fine but now if I add a new term in admin/structure/taxonomy/tags/list the menu doesn't update, I mean that the new added term doesn't show up.

The problem is that I can't find to check: Synchronises change to this vocabulary because
I don't have this option in admin/structure/taxonomy/tags/edit as showed in the tutorial. Maybe this is because I'm using D7 and the tutorial is for D6? Where are these options in D7?


texts: How to give pagination for Rest Service data

texts:
I am using Rest Service and pull the data from another non drupal db.

I wrote custom module with two form elements and render that data (rest service call) and display using theme table.

I wrote  $form['pager'] = array('#theme' => 'pager'); for pagination.

Pagination is working only for data which rendered using db query. In my condition it's not working.

How can I add pagination for my table.

 function myForm($form, &$form_state){
 pager_array_splice($final_data, 10);
foreach($final_data as $key => $value){
     $source=explode('=',$key);
     $options[]=array(
        'Token_Source'=>$source[0],
        'Tokens'=>$value,
     );
}

$form['pagerTop'] = array('#theme' => 'pager');
$form['entities'] = array(
  '#type' => 'tableselect',
  '#header' => $header,
  '#options' => $options,
  '#attributes' => array('class' => array('entity-sort-table viewTable tokensTable')),
  '#empty' => t('There are no Notification ....'),
);
$form['pagerBottom'] = array('#theme' => 'pager');
return $form;
}
function pager_array_splice($data, $limit = 9, $element = 0) {
print_r($data);
global $pager_page_array, $pager_total, $pager_total_items;
$page = isset($_GET['page']) ? $_GET['page'] : '';

// Convert comma-separated $page to an array, used by other functions.
$pager_page_array = explode(',', $page);

// We calculate the total of pages as ceil(items / limit).
 $pager_total_items[$element] = count($data);
$pager_total[$element] = ceil($pager_total_items[$element] / $limit);
 $pager_page_array[$element] = max(0, min((int)$pager_page_array[$element],     ((int)$pager_total[$element]) - 1));
 return array_slice($data, $pager_page_array[$element] * $limit, $limit, TRUE);
}


texts:
i would like to know of there's a plugin to let an authentified user customize his home page by moving and adding predifined widgets like (agenda, events ..), using drag and drop like iGoogle.

i'm still drupal newbie, any advices are welcomed.


texts: How to set multiple values to an unlimited Term Refence field with Rules

texts:
I have two content types: Ingredient and Recipe Sheets.

Both Ingredient and Recipe Sheet have a term refence field called Allergens.

Ingredient has the Allergens term reference field filled in. IE: Milk, Gluten.

While in Recipe Sheets Allergens is empty.

Ingredient has an Entity Reference to Recipe Sheets.

Now, I want when Ingredient content type is viewed, to automtiacally copy all the terms from allergens and put them into the Allergens of the Recipe Sheet that is entity referenced (the entity reference field can only have 1 value).

In my rule, when Ingredient is viewed, I use Action of loop then item list to get all the Allergen field terms from A (Ingredient). Then another action to run my component and I pass that list to my component.

Here is my component ("B" refers to "Recipe Sheet"):

When I do this action, for Allergens, only the last tax term gets checked in B.

How do I get it, so it checks all the terms from the list and not just the last one?

Sample Rules Export:

{ "rules_testing" : {
    "LABEL" : "Testing",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_view" : [] },
    "IF" : [
      { "node_is_of_type" : {
          "node" : [ "node" ],
          "type" : { "value" : { "ingredients" : "ingredients" } }
        }
      }
    ],
    "DO" : [
      { "LOOP" : {
          "USING" : { "list" : [ "node:field-allergens" ] },
          "ITEM" : { "list_item" : "Current list item" },
          "DO" : [
            { "entity_fetch" : {
                "USING" : { "type" : "taxonomy_term", "id" : [ "list-item:tid" ] },
                "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
              }
            },
            { "component_rules_lalala" : {
                "node_referenced" : [ "node:field-reference" ],
                "nids_of_terms_from_allergens" : [ "entity-fetched:parents-all" ]
              }
            }
          ]
        }
      }
    ]
  }
}

Sample Component Export:

{ "rules_lalala" : {
    "LABEL" : "lalala",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : {
      "node_referenced" : { "label" : "Node(s) from Entity Reference", "type" : "node" },
      "nids_of_terms_from_allergens" : {
        "label" : "NIDS of Allergens from Ingredients",
        "type" : "list\u003Ctaxonomy_term\u003E"
      }
    },
    "IF" : [
      { "node_is_of_type" : {
          "node" : [ "node-referenced" ],
          "type" : { "value" : { "recipe_sheets" : "recipe_sheets" } }
        }
      }
    ],
    "DO" : [
      { "data_set" : {
          "data" : [ "node-referenced:field-allergens" ],
          "value" : [ "nids-of-terms-from-allergens" ]
        }
      }
    ]
  }
}


texts: Is there any PHP package that's very similar to the Plugin API?

texts:
I really like the Drupal 8 plugin system. I am now also working on a non-Drupal related project and am wondering if there's any similar solution to that on packagist.org? Was trying to find one but without success (maybe wrong keywords).

Does anyone know where the idea was coming from? Or is it original Drupal thing?


texts: Drupal 8 - "Implement menu links as plugins", trying to build a menu tree

texts:
In a previous Drupal 8 menu question here, we determined that menu tree building was now a service. In my D8 contrib theme, I was then able to render the main menu tree as:

function gratis_preprocess_page(&$vars, $hook) {
// Build the main menu links tree.
  if (!empty($vars['main_menu'])) {
    // Build links.
    $config = Drupal::config('menu.settings');
    $menu_enabled = Drupal::moduleHandler()->moduleExists('menu');
    // When menu module is not enabled, we need hardcoded default values.
    $main_links_source = $menu_enabled ? $config->get('main_links') : 'main';
    $vars['main_menu'] = \Drupal::service('menu_link.tree')->renderMenu($main_links_source);
    $vars['main_menu']['#attributes']['id'] = 'main-menu-links';
    $vars['main_menu']['#attributes']['class'] = array('links', 'clearfix');
    $vars['main_menu']['#theme_wrappers'] = array('menu_tree__primary');
  }
}

The key to this is the use of:

$vars['main_menu'] = \Drupal::service('menu_link.tree')->renderMenu($main_links_source);

This worked great to fix my main menu tree in Drupal 8 Alpha 11. However, there have been more sweeping changes to the menu system since then and now in Drupal 8.0.x Alpha14, this breaks again with the error:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "menu_link.tree". Did you mean this: "menu.link_tree"? in Symfony\Component\DependencyInjection\Container->get() (line 303 of /Users/danny/Sites/Drupal/d8/drupal8/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php).

The thing that stands out from the above seems to be:

Did you mean this: "menu.link_tree"?

I tried

$vars['main_menu'] = \Drupal::service('menu.link_tree')->renderMenu($main_links_source);

... but that does not work either.

I filed a core issue here and that lead me to "[META] New plan, Phase 2: Implement menu links as plugins" and the very same change notice which I used to upgrade this code originally.  Admittedly, I am pretty lost here.


texts:
I have the Search API and the Solr search modules installed. In /admin/config/search/search-api, I see my server and index created and with status set to OK. I can see on the index view page that my content is indexed correctly.

I did not use the Solr Search Defaults module because I have removed the default Article content type, and I don't want to recreate it. Without this content type, there is an error when activating the module.

How can I create a search page displaying all indexed results (for anonymous users, not in BO)?

One tutorial shows that Solr Search Defaults module uses views. I've created a view, where in View settings > Show I've selected Ideas index.
In the view, Format > Show is set to Rendered entity. Search index is the view mode. I have a page, but no content is displayed.
No filters are required, and all are exposed.

Other tutorial says I should create a search page in Configurations > Search and metadata > Search pages menu, but I don't have that menu.

Here are my Fields for Ideas index.

Here is another view I've tried, with Show > fields

Here are my error logs, there is a Notice:

Here is what I see using {{ kint(page.content) }} on my Search results page:

If I create a view with VIEW SETTINGS > Show > Content my content IS diplayed correctly.


texts: How do I show 2 images on row 1 and 3 images underneath on row 2 with Views?

texts:
I need to create a page on my Drupal website which shows colleague images (colleague profile pics).

I want to position 2 colleagues pics next to each other on row 1 then underneath show 3 images on row 2, as shown in this picture:

I have set up a content type called Colleagues, which has fields of Title and Image. And I have set up a View to read that content and display the images, and the title underneath.

I can display them in whatever order I need, but how do I display them so that there are 2 at top and 3 underneath?

The only way I can think of is to add a field called Row Number, and create 2 Views for each row and display them accordingly, but that seems messy.

Can anyone help?


texts: node.getRevisionCreationTime equivalent in views

texts:
This question is somewhat related to Comparing node creation and modification dates in twig I asked earlier.

For the website in question, we agreed to the following semantics of the various dates related to a node (in our case, blog posts):

Creation date: The date the note was created.
Changed date: The date when any of the node's modifiable settings were changed.
First publication: The date the node was first published (using Drupal module Publication Date).
Publication date: The date a new revision of the node has been created - in other words, the current revision's date.

In rendering the content, all is well when using node.getRevisionCreationTime for the publication date in the relevant twig templates and display modes.

However, I what certain blocks and views to order the blog posts by publication date as defined above.

I fail to find the right settings when defining the view - I find the Views user interface incredibly complicated and not intuitive at all. In my (perhaps naive) assumption, using the Content Revision field Changed or Authored on as sufficient, but I suspect that that doesn't always relates to the current revision.

See the attached screenshot on how I have defined the view:

UPDATE: An example:

The above view (with some filtering on example name) gives the following result:

Taking a screenshot when editing the node I get this:

So far, so good: Node creation, publication and changed times all match. But look at the "Revision created" and "Revision changed" dates - they match the corresponding node times!

Checking the node's revisions, I see that the current revision's date (which date exactly? Created? Changed? Something else?) is 12 June 2018 - but nowhere to be found in my view - see screenshot:

The revision date 12 June 2018 is the date I want to fetch as the "Publication date" explained above.

How do I do that in a view?

Please help!

TIA,
Michel


texts: How do I get a nodes authors email address within views?

texts:
I have a view that list nodes of a certain type. These nodes are created by different users.

In my view, how would I get the email address of the creator of the particular node (I will pass this email to a webform)?


texts: $base_url not working when in anchor link to theme folder

texts:
e.g. this:

<a href="<?php echo $front_page; ?>" title="<?php echo t('Home');?>" rel="home" id="logo">

is working.

But this is not:

<a href="<?php echo $front_page; ?>" title="<?php echo t('Home');?>" rel="home" id="logo">
        <img src="<?php echo $base_url; ?>/sites/all/themes/jamestheme/images/logo.jpg">

Can someone explain why?

I am using Drupal 7 and this code is in page.tpl.php


texts: How do I pass a checkbox value to a Webform through URL?

texts:
When I click a webform link, I want one of the checkbox checked. I've set already set up the default value for that checkbox as %get[foo] in Webform.

I tried:

a href="node/34?foo=checked"

a href="node/34?foo=selected"

a href="node/34?foo=1"

a href="node/34?foo[]=1"

Am I missing something?


texts: Drupal Commerce: Allow anonymous users to choose password

texts: I'd like to allow anonymous users to make purchases on my store, however I don't want them to have to login and then change their password as their first port of call. Is there anyway I can collect a password from the customer during checkout, like it is possible to in Ubercart 3 and with LoginToboggan?


texts: How to disable a feature whose checkbox is grayed out?

texts: I would like to disable some features, but they are grayed out. What does that mean? I assume some kind of dependency? (I am using Drupal Commons and would like to disable groups.)


texts: Show datetime value in views with entity api

texts:
I made a custom entity with a date field stored as datetime in mysql.

I see the proper output in my content, and all other field values in my views except the datetme value. Only the label is shown. So I believed that I have to write a getter callback because of this:

  getter callback: (optional) A callback used to retrieve the value of the property. Defaults to entity_property_verbatim_get(). It is important that your data is represented, as documented for your data type, e.g. a date has to be a timestamp. Thus if necessary, the getter callback has to do the necessary conversion. In case of an empty or not set value, the callback has to return NULL.

Question is how to use it? Apparantly I have to get a timestamp from a datetime field!???

Another one mentioned that views doesn't relate to property_info():

  Getter and Setter callbacks are used only by entity metadata wrappers, not Views.

So my code looks like this atm:

$info['pricedefault']['properties']['preis_zeitraum_von'] = array(
'label' => t('Start period'),
'description' => t('Preis Zeitraum von'),
'type' => 'date',
'schema field' => 'preis_zeitraum_von',
);

So it makes no sense to add a getter callback??? Or do I have to make my own views entity controller class?

ATM I'm very confused. Can anybody explain how to proceed?

THX in advance

maen


texts: Computed field - count number of taxonomy terms in term reference field

texts:
So I simply want to count the number of tags on a term reference field.. I've tried a count (below) and it simply returns "1" (there are a lot more terms tagged than 1):

$entity_field[0]['value'] = count($entity->field_termref);

Also something like below does not work either and also returns "1" - I'm thinking I have to loop through the multiple tags somehow but I'm not sure how to do it. Thanks a lot for any help.

$myterms = array();
foreach($entity->field_guests as $tmp) {
  $myterms[] = $tmp_field_term;
}
$entity_field[0]['value'] = count($myterms);


texts: How do you run Drupal core-patches and is there a single, general way?

texts:
When I run contrib-module patches I download the patch file, put it in the modules folder, navigate to there with the Linux-bash and then do git apply patch patch_file_name.

I never ran a core-patch though and I believe it's a bit different as there isn't necessarily a single module to act upon.

So, is there a one single way to run Drupal core patches and how it should be done without damaging anything? Maybe just put it in the site root folder and run it?

I ask this here so people who write such a question in Google could find this info easily.


texts: Calculate values from multiple content items

texts:
I have a Drupal 7 website that will be used to track automobiles in a fleet, as well as their engines and a few other items. Regarding the engines, I will be tracking the number of hours the engine is used, and the number of miles put on the engine in each use. To do so, I have an "Engine Usage" content type set up with fields for "hours used this trip" and "Mileage this trip". Each time the Engine is used, a new Engine Usage content item will be created manually, and the hours/miles will be entered into those fields. The Engine Usage content type is linked to the Engine content type/item by way of the Node Reference module.

I now need to create a View that will pull in the information for the Engine content item (its specifications, etc), as well as the total usage for that Engine by way of its related/linked Engine Usage content items. Instead of displaying each of the usage items separately, I need to apply a calculation to them, in the form of "Engine Usage for content item Engine123 'Hours driven'" multiplied by "Engine Usage for content item Engine123 'Mileage this trip'". I have looked into Views Calc, bu I cannot figure out how to first combine all of the Hours for the Engine Usage content item for any given engine, and then combine all of the Mileage for the Engine Usage content item for any given engine. If I can get to that point, I think I can then figure out the rest of the calculation on my own.

The end result will be a View block with a contextual filter that will pull the info in based on the ID of the content item being viewed. So when viewing the content item Engine123, the block with the calculated hours * mileage for Engine123's usage content items would be displayed.

Any ideas? Please let me know if any of this is too vague.


texts: Why isn't media respecting my allowed file type settings

texts:
In my field settings for a media based image field, I have this:

When I upload an image and click next I get the following:

both of those types allow image files, but this particular field should only allow items to be classified as images.  Why is the setting not being respected?


texts: How can I automatically create a menu link for a new node in Drupal 8?


texts: How to notify users when a new comment is posted in the same page as they did?

texts:
I have a Drupal 7 website and I display comments on a content type.

What I want, is for every user to have a boolean field in their profile, to declare if they want to be notified when a new comment is posted at the content type that they posted.

I tried the Comment Notify module, but it shows its options right before you post your comment, and doesn't have a use with user profile/field.

I have already achieved a similar notification, for the user to be notified when the administrator replies to one of the user's comments.

I managed it using the Rules module, before a comment is posted, with these Rules Conditions:

Entity has field (comment:parent:author) and Data Comparison, to verify a relevant boolean at the user profile.
Data Comparison, for the (comment:author:roles) to be administrator.

Although, I can't seem to achieve the requested rule.

I know I have to do a search for every commenter at the same node, before a comment is posted, if they have the boolean enabled at their profile, but I can't create it with Rules.

To sum up, I have a content type (projects) and I have created about 50 of them. If some user X posts a comment on one of the projects and has the boolean enabled, then if anyone else comments on the same project, user X will be notified by email.

Any help?


texts: How to get page elements to span the entire page using Drupal 7, zen 7.x-5.x, ZenGrids

texts: What I want to do is what John Albin does on the www.zengrids.com with that green bar element "features".


texts: Notify users of new logged heartbeat activity

texts:
I am using Heartbeat module for a notification system, I've created a pop up block which shows all the logged activity targeted to a certain user. Is there a way to alert the targeted users of new logged activities.

For example, like the notifications on Facebook or twitter?

Any help would be greatly appreciated.


texts:
I have a custom module (my_module); Inside this module I have a custom class (MyClass), where I want to use a Drupal service (file_system).

This is my code.

src/MyClass.php

namespace Drupal\my_module;

use Drupal\Core\File\FileSystem;

class MyClass {
  public function __construct(FileSystem $file_system) {
  }

  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('file_system')
    );
  }
}

When I instantiate this class (in a controller for example), I get an error.

$my_class = new MyClass();

  TypeError: Argument 1 passed to Drupal\my_module\MyClass::__construct() must be an instance of Drupal\Core\File\FileSystem, none given

What is wrong in my code?


texts: Passing in URL parameters to menu callbacks

texts:
I implemented hook_menu() to create a new path called 'user-login'. The page callback function receives url parameters like $_GET['parameter']; however, when I go to http://site.com/user-login?parameter=test, I get a 404 error. How should I implement hook_menu() to get this working?

This is the code I'm using

/**
 * Implementation of hook_menu()
 */
function login_menu() {
  //$items = array();

  $items['user-login'] = array(
    'title' => 'External login',
    'page callback' => 'user_login_callback',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );

  return $items;
}

function user_login_callback() {

  // Get the URL params
  $uid = urldecode($_GET['uid']);
  $expiry = urldecode($_GET['expiry']);
  $provided_hash = urldecode($_GET['hash']);

}

Page would be called like http://site.com/user-login?uid=2?expiry=3?hash=sd7wdah


texts:
is it possible to manually select content for a view? I'd like to create a related content view but I want to add the links manually for every article, not using taxonomy.

Is it possible? Is their a certain module that exists?

Thanks for any help


texts: How to import Joomla user created date to Drupal?

texts:
This new site is migrated from Joomla to Drupal. Most users were created 44 years ago and they should not be. I found out the created date format is different between Joomla and Drupal. So, how can I migrate or convert Joomla created date(something like this "2008-08-05 20:20:42.000000") to Drupal(something like "1335285830")?

Additional information

PS: I output Joomla Created Date as CSV.


texts: can hook page alter also do all the things that hook form alter can do..?

texts: Since the page alter hook also has information about individual form fields is it correct to say that hook page alter can do everything that hook form alter can do


texts:
I'm figuring out how migrating works. When trying to migrate one of my nodes from a Drupal 7 site to Drupal 8 site I can't figure out how to set the Text Format of a field. I found this solution below, when looking for an answer, but this doesn't work.

field_name:
      plugin: get
      source: field_name
      process:
        value: value
        format:
          plugin: default_value
          default_value: "basic_html"

I also tried something like

field_name:
          plugin: get
          source: field_name
field_name/format:
          plugin: default_value
          default_value: "basic_html"

Or

field_name/value:
          plugin: get
          source: field_name
field_name/format:
          plugin: default_value
          default_value: "basic_html"

But non of these work. What am I doing wrong?


texts: Is there a module that allows images to be uploaded and inserted in place, like in a block or something similar?


texts: Trying to change a radio value during form validate

texts:
I have a form that includes a set of radio inputs, and other fields that will or will not be relevant, depending on which radio option is selected. I'm using #states for client-side UX sugar.

However there are certain conditions, picked up in the validate function that need to change the value the user entered for the radio, and re-present the form with a different option selected. I'm having problems with this, as the form comes back but the option is not changed. e.g. Submitting this should with 'a' selected should change it to 'b' and re-present.

What happens is that the value is set to b, the form rebuilds, but the browser still shows 'a' selected.

<?php
function x_a_form($form, &$form_state) {
  return [
    'switcher' => [
       '#type' => 'radios',
       '#options' => [
           'a' => 'Aye',
           'b' => 'Bee', ],
       '#default_value' => empty($form_state['values']['switcher'])
                           ? 'a'
                           : $form_state['values']['switcher'],
    ],
    'submit' => ['#type' => 'submit', '#value' => 'Go' ],
  ];
}

function x_a_form_validate($form, &$form_state) {
  // silly example of a condition...
  if ($form_state['values']['switcher'] == 'a') {
     // Change the value.
     // Nb. form_set_value() is a very long winded way to do just this:
     $form_state['values']['switcher'] = 'b';
     // We will not be saying anything is invalid, but we don't want
     // the form to submit.
     $form_state['rebuild'] = TRUE;
     return;
  }
  // other validation...
}


texts: I'm writing a drush command, and outputting the results in table format. Everything works fine, the command runs, the output is displayed where it should be. However, there is one column where I am putting "Ok", "Warning", "Error" and I would like to be able to add color to that (the way drush does for its own commands). Yet I have looked everywhere without success to find instructions about how to do it, and would welcome some pointers.


texts: How can we catch the acces denied exception?

texts:
I've run into a case where users need to be redirected to the login page when they try to access a page without having the permission to access it.

How can I catch an exception  of the AccessDeniedHttpException class?


texts: I created custom module and I installed it on "Add Module" page. I've got that module in sites/all/modules. I changed that module (I went to that location and I recoded it). What should I do to update that module. It seems to me that only after recoding that module Drupal doesn't notice changes.


texts: Using menus anywhere on page - how to stop them expanding by default when not used in menu region ( e.g. in a block or panel)?

texts:
I am trying this with superfish but the menu options are expanded by default.

What would I need to do to get it to behave like it does in a menu (i.e. collapsed by default).

I want to use the menu drop down within the content (Edit i.e. within a panel or a block so that I can have drop-down menu functionality anywhere on the page (hence the tags).


texts: Masquerade stopped working, throws validation error

texts:
The Masquerade module has stopped working on my site. Drupal 6.28, (Drupal Commons 1.x) Masquerade 6.x-1.6.

When we enter a username in the Masquerade field the site throws the following error, does not let me masquerade, and redirects me to a profile page of a blocked user (http://www.hastac.org/users/bizworld) which  is most certainly not the user I was trying to masquerade as!

  Validation error, please try again. If this error persists, please contact the site administrator.

I tried disabling and renabling the module, removing and restoring the user permission to masquerade, and re-saving the module configuration page. Anyone know what's wrong or other solutions to try?


texts:
I created a few regions for my footer. Inside of each region I've added a custom block with plain html code. One has the contact info, another has social media icons and the last one has a map.

The custom block dedicated for the social media icons has only an h2 heading and the a tags for the icons. I'm using font icons for the logos (I know probably not the best for accessibility), so the a tags don't have any text in between them. I am however using the title attribute along with the href attribute.

Everything gets saved and is rendered correctly, however, when I go back to the custom block to make edits all of the a tags are gone; the h2 tags are still there. As long as I don't hit the Save button again the site remains the same, but if I hit Save, obviously all of the icons are gone. I have Full HTML selected as the Text Format so I know that is not the issue. Is there a setting that I have to set to allow empty a tags or is this not allowed at all??

I don't want to hard-code these sections in my template as I want my site administrator to be able to edit each block if necessary.

Any help would be appreciated.

Thanx

I'm running Drupal 8.05 on Ubuntu 14.04

UPDATE

I double checked to make sure there aren't any missing tags. I also updated my code to:

Best Rate Guarantee

This time the a tag remains but the empty span tag is removed.


texts: How to add an external image to node with a module?

texts:
I have created a form through my module in which the user(anonymous) can enter an image URL and some title for the image.
The link needs to be, like with remote stream wrapper, shown as an actual image.
So this means, the image should be used from an external sources and not be download on my local server.

$node = new stdClass(); // Create a new node object
$node->type = "article"; // Or page, or whatever content type you like
node_object_prepare($node);

$node->title    = filter_xss($_GET['title']);
$node->language = en; // Or e.g. 'en' if locale is enabled

$file_path = $_GET['link'];

$file = (object) array(
        'uid' => 1,
        'uri' => $file_path,
        'filemime' => file_get_mimetype($file_path),
        'status' => 1,
);

$node->field_image[$node->language][0] = (array)$file;

$node->uid = 1; // UID of the author of the node; or use $node->name

node_save($node);

I have this code and it doesn't save the image URL. I'm sending the 'link' and 'title' properties through AJAX.


texts: What is the difference between $variables['elements']['#node'] and $variables['node']?

texts: Just wonder what is the difference between $variables['elements']['#node'] and $variables['node'] in hook_preprocess_node(). Are the same instance of the same node?


texts:
Following this I have created a module to migrate d7 users to d8. I have enabled all mandatory modules needed to run migration. But when I do drush migrate-import {mymigrationid} ; it says : Migration not found.
But When I did "drush config-list|grep migrate" , it is showing that particular migration:

migrate.migration.d7vm_users
migrate_plus.migration.custom_user

But when I'm doing drush migrate-status, these migrations are not listing up there.
Can anyone tell what's supposed to get missed?
Here is my mymodule/config/install/vm.yml file
id: d7vm_users
label: User accounts
migration_tags:
  - Drupal 7
dependencies:
  enforced:
    module:
      - mymodule
source:
  plugin: d7vm_users
destination:
  plugin: entity:user
process:
  uid: uid
  name: name
  pass: pass
  mail: mail
  created: created
  access: access
  login: login
  status: status
  timezone: timezone
  langcode: language
  init: init

and src/Plugin/migrate/source/User.php
<?php
/**
 * @file
 * Contains \Drupal\mymodule\Plugin\migrate\source\User.
 */

namespace Drupal\mymodule\Plugin\migrate\source;

use Drupal\migrate\Plugin\migrate\source\SqlBase;

/**
 * Extract users from Drupal 7 database.
 *
 * @MigrateSource(
 *   id = "d7vm_users"
 * )
 */
class User extends SqlBase {

  /**
   * {@inheritdoc}
   */
  public function query() {
    return $this->select('users', 'dcf_u')
      ->fields('dcf_u', ['uid', 'status', 'created','access', 'login',    'name',
        'pass', 'mail', 'init', 'language']);
  }

  /**
   * {@inheritdoc}
   */
  public function fields() {
    $fields = [
      'uid' => $this->t('Account ID'),
      'status' => $this->t('Blocked/Allowed'),
      'created' => $this->t('Registered date'),
      'access' => $this->t('Time of last access'),
      'login' => $this->t('Time of last login'),
      'name' => $this->t('Account name (for login)'),
      'pass' => $this->t('Account password (raw)'),
      'mail' => $this->t('Account email'),
      'init' => $this->t('init'),
      'language' => $this->t('language'),
    ];

    return $fields;
  }

  /**
   * {@inheritdoc}
   */
  public function getIds() {
    return [
      'uid' => [
        'type' => 'integer',
        'alias' => 'dcf_u',
      ],
    ];
  }

}
?>


texts: Starting a site from scratch after running "drush sql-drop"

texts: In drupal 7 I was able to just do a drush sql-drop and then visit the site and it would throw the install screen. But in Drupal 8 I'm getting an error when I do a drush sql-drop when going back to the site. Are there static files I need to also delete in Drupal 8 along with doing a sql-drop?


texts: Soft and hard copies of a single product in Drupal Commerce?

texts:
I am setting up products for an online store using Drupal Commerce. Some of the products (eg. books, music) require an option for both hard copies and soft copies so that customers can choose one or the other. I would like certain products to have a drop down in which customers can choose either "Hard Copy" or Soft Copy" and the price will change accordingly. Then depending on the option chosen, after payment, the customer will get a confirmation email for the hard copy, while for the soft copy they will also get the download link.

I have installed Commerce File to cover the soft copy option, since Drupal Commerce handles the hard copy option out of the box (being a manual shipping process), however I cannot see how this can be done using this module. I have created a commerce file product which allows for soft copies, and a standard product which allows for the hard copies; but how do I create a product that has both of these as an option? Is Commerce File not the module for this?


texts: Change the title of date_popup filed in custom form

texts:
I'm building a custom form in Drupal 7 and i need to use the date_popup widget in it. It all works as expected, except the title of the field.

My code is:

  $form['filter']['start_date'] = array(
    '#type' => 'date_popup',
    '#date_format' => 'd-m-Y',
    '#title' => t('Start date'),
  );

  $form['filter']['end_date'] = array(
    '#type' => 'date_popup',
    '#date_format' => 'd-m-Y',
    '#title' => t('End date'),
  );

But it keeps showing the default label "Date" for the field, as you can see on in the picture below.

Can you please let me know how can i put Start date and End date as field labels instead of just Date, or correct me if i'm doing something wrong


texts:
I'm using a batch job in Drupal 8 to scrape pages from another site to import.

I'm using httpClient, and I have it wrapped in a try/catch.

try {
  $response = \Drupal::httpClient()->get($parts['scheme'] . '://' . $parts['host'] . $parts['path'], [
    'query' => $parts['query'],
    'headers' => array('Accept'=>'text/xml'),
    'verify' => FALSE,
    'connect_timeout' => 6,
    'CURLOPT_SSL_VERIFYPEER' => false,
    'CURLOPT_CERTINFO' => false,
  ]);
  return (string) $response->getBody();
}
catch (Exception $e) {
  watchdog_exception('scrape', $e);
  return FALSE;
}

However, from time to time the remote site times out, and the guzzle exception is not caught, which causes the batch job to end.

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /batch?id=44&op=do_nojs&op=do
StatusText: Internal Server Error
ResponseText: The website encountered an unexpected error. Please try again later.GuzzleHttp\Exception\ConnectException: cURL error 28: Operation timed out after 30001 milliseconds with 0 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in GuzzleHttp\Handler\CurlFactory::createRejection() (line 186 of vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php). GuzzleHttp\Handler\CurlFactory::finishError(Object, Object, Object) (Line: 103)

This job imports a few thousand pages, so when the error happens in the middle of the batch, it's a major pain.

I am getting ready to write a queue for the batch processor, where the batch pops a set of items off the queue and then marks them as done, so that I can continue the job after an exception.

But then I wondered, is there already a way to tell Drupal to continue a batch from where it left off or was interrupted? I did some googling and didn't find anything indicating that this feature already existed. I don't want to re-invent the wheel if I don't have to.

Can I re-start an incomplete, interrupted batch job?


texts: What's the best way to implement a system to allow the end-user to download and buy documents?

texts:
I need some advise on how to build a system to allow users to download and purchase pdf files. A purchase option is a one time only thing and no order history of login is required.

The end user just needs to see a list of documents, some of which can be purchased and then when the hit buy the can pay at a Payment Provider and download.

I don't need a shopping cart, order history, login or anything.

What is the best way to approach this with Drupal 7? I was thinking of maybe using the Entity API to create a download entity, would that make sense.


texts: Is it posible to use taxonomy terms in Context module?

texts:
We are developing a Drupal 8 site and we need to create an specific sidebar with Context module using Taxonomy Term. In D7 module version is very easy: you can select an specific taxonomy term... but in Context for D8 we cannot find this option. We only find Vocabulary.

Is it not possible in D8? Or in other words... how we can do it?


texts: How do I create taxonomy terms from an exploded list?

texts:
I have followed the procedure outlined on How to add multiple terms to a taxonomy reference field via feeds?

However, I'm unsure of what else to do in order to create taxonomy terms from a set of words imported via Feeds.

How should my content type be set up? I currently have the field set up as 'term reference' and have tried 'select list' and 'autocomplete' as widget type; neither displays any of the field data as a taxonomy term.


texts:
I have the following image and when I click on  it. it will pop out into a colorbox modal, but it currently re-sizes it to fit to the window. How would I just resize it up to only the width of the window and have the user scroll down to see the rest of the image?

I'm using the colorbox module. I know I have to unset the innerHeight to auto or something. But how would you override a javascript snippet without affecting other pages on the site?


texts: How to add menu items to system.admin_content parent?

texts:
parent: system.admin_content route handles /admin/content path. I'm trying to add more items to the menu tabs visible on that page.

So I'm doing this:

# test.routing.yml
entity.admin.test:
  path: '/admin/content/test_entity'
  defaults:
    _entity_list: 'test_entity'
    _title: 'Test entities'
  requirements:
    _permission: 'administer content types'

# test.links.menu.yml
test.admin:
  title: Test entities
  route_name: entity.admin.test
  # I have also tried using route defined in my entity type annotation
  # route_name: entity.test_entity.collection
  parent: system.admin_content
  description: 'List and edit site test entities.'

The route works (I can access page at /admin/content/test_entity), but menu item is not displayed. If I change parent to for example system.admin_structutre then the menu item is shown on /admin/structure list without problems.


texts: Does having lots of regions create performance issues

texts: I am building a site in drupal 7. All the contents are created  using views.The themes structure is such that i have to use a lot of regions to display the blocks created by views. Its almost like one region for one block. Does having lot of regions impact performance. I could  avoid using regions if i print views using views_embed_view() function. But i think that is not recommended. You suggestions please.


texts: I am using Drupal 8 and want to know how I make my wesbite only usable when a user login. At the moment my websites features also used when a user has not logged in.


texts: "You need to be logged in to view that page" alert for authenticated user

texts:
I have created a page using hook_menu for "employee" role using the code below:

 $items['admin/employee'] = array(
    'title' => 'Dashboard - Employee',
    'page callback' => 'employee_page',
    'access arguments' => array('Access administration theme'),
    'type' => MENU_NORMAL_ITEM,
);

When this page is viewed by an employee this alert appears: "You need to be logged in to view that page".

I tried to rebuild cache etc.

PS. I don't have an issue to access this page as an admin. Maybe I should use different access arguments?


texts: Why is my view for Solr indexing is not showing any results?

texts:
I have installed solr 8.2.0 for drupal 8.7.6.

My Solr server and index are enabled and indexed. But when try to search via views, the results are not showing up. Please help me in solving this.

My New view


texts: How to embed Drupal content in other websites?

texts: I want to be able to have widgets with Drupal content to be embedded in other websites. For example a widget could show "new stories" or "top stories".


texts:
Is there a way to populate a content type field with the custom roles registered in Drupal (minus authenticated and anonymous)???

I have googled and found only quick hacks using custom modules, etc. Any ideas?


texts: Related node views - some elements with date field, some without. How to include elements with no date in results?

texts:
I have a views block that displays related nodes based on tags. (See Entity Reference get nodes based on tags.) The comment links to the solution I found.

Now, I have to add another filter to the view.

Some of the related nodes have a date field (start and end date), and some do not. When I add a filter to exclude nodes where end dates have come and gone, no related nodes without the date field is shown.

How is it possible to filter out nodes where the end date is greater or equal to now on nodes with the date field, but still show nodes that do not have the date field?


texts: "add content" suddenly not showing on navigation block anymore

texts:
Good day,
I'm having a problem of a block not showing its content!
the block is stock and called navigation, which has "add content" in its links.

but just recently, it has not been working on other users except admin.
i checked it setting, and the access control says: "authenticated users" which is good.
but the moment i check it at other users (the non admin), i can only see the navigation block with "chaos Ajax demo" ONLY..

i checked around possible permissions, link settings, but with no luck..nothing seemed strange to me..

here's a screen shot of the navigation block at admin:

and here's 2nd shot at non admin (was working and showing few days back, but then suddenly became like this):

logically speaking, since the navigation block is existing at other users only means that its permissions is allowed for users to see the block.

but why suddenly it stopped showing the links?? im very much concerned about "add content" link, because i need it to add contents (otherwise, i'll have to go through a headache of creating 10s of manual links for each content to add).

let me note that I'm quit new to drupal, that's why I'm not pretty sure what did i mess with here.

any help is very appreciated, Thanks


texts: Embedded images not shown in Google Chrome

texts:
I just realized that my embedded images, from an external source, aren't shown up in Google Chrome, but they are working fine in Safari and Firefox.
I cannot even click the link I generated with the tag, as it's not clickable.

Maybe someone has an idea on why this is happening.

<a href="content/httpwwwgooglede#content-top" title="Hier geht's zur Homepage von http://www.google.de"

This was generated through the Display Suite Module, within a view:

<?php $text = ltrim($object->field_link['0']['url'],'http://')?>
<?php $orig = drupal_lookup_path(source,$object->path); ?>
<a href="<?php print $orig; ?>" class="homepages_klein" title="Hier geht's zur Homepage von <?php print $object->title; ?>">
<img width="202" height="152" title="<?php print $title; ?>" alt="Hier gehts zur Homepage von" <?php print $object->title; ?> src="http://www.kwengo.de/external/shots/get.thumbshots.ru/%3Furl=<?php print $text;?>%26size=m%26v=1%26lang=en%26" />


texts: How to override theme() part in page.tpl.php file?

texts:
This question is extension of this question: Current Username title instead Secondary menu title, but it is different.

I would like to how can I override the following part of code  theme('links__system_secondary_menu',............) which is in page.tpl.php

For example, if I want to change text => t('Secondary menu') to text => t('Any new text').

One way to do this, which I think is just change that part in page.tpl.php and it works perfectly.

OR

Is there any other way like hook-way to do this, so we can write function in template.php and that override only that part?

from page.tpl.php

<?php if ($secondary_menu): ?>
      <div id="secondary-menu" class="navigation">
        <?php print theme('links__system_secondary_menu', array(
          'links' => $secondary_menu,
          'attributes' => array(
            'id' => 'secondary-menu-links',
            'class' => array('links', 'inline', 'clearfix'),
          ),
          'heading' => array(
            'text' => t('Secondary menu'),
            'level' => 'h2',
            'class' => array('element-invisible'),
          ),
        )); ?>
      </div> <!-- /#secondary-menu -->
    <?php endif; ?>

Thanks,


texts: How do I add an 'order complete' from the Commerce module to the Rules events in Drupal 8?

texts:
I need to add a new event to rules triggered by the successful completion of an order. The action is to grant a user a role which will expire in a fixed duration.

I've tried following the Rules documentation and adding a module with a *.rules.events.yml file. But modifying it to use the order_complete event which I got from this tutorial.

Unfortunately, even though it DID add an option to the events drop down, it doesn't trigger an action.

I've tried a grep through the commerce code for order_complete but it doesn't yield anything.

The action I've set to the rule is just to print a message.


texts: Sorting a new column on task list on open atrium

texts:
Hey I have added two new column's to a task list. One is a Due Date (Date chosen by calendar) and the second is number of days out (integers). The other column's that are added by default are able to be sorted, however the two new columns only have a black title.

Is there a way to add the ability to sort these new columns?


texts:
I am using drupal 7 and entityform module and also using this : https://www.drupal.org/node/1679794
instruction to sending email after submitting form.
the only problem I have is I want my email body to be translatable in different languages.
I already translated form labels here :

admin/config/regional/translate/translate

I also should add my form is a custom form not user sign up form ! I already know that I can change email body of sign up email here :
admin/config/regional/i18n/variable

using rules module and After saving a new entityform submission event was also useless. it's like the event is not equal to form submission event . happens nothing after form submission.
I also thought it would be helpful if I just could add some varibles to drupal default variables ! but I don't know how .


texts: How do I determine a page's content type for non-node pages?

texts:
I’m trying to modify my theme’s page.tpl.php to not show certain regions when I’m displaying content from the core forum module.

<?php if (!$node->type == 'forum'): ?>

<?php print $sidebar; ?>

<?php endif; ?>

This works fine when I display actual forum nodes, but not when I show pages with the forum listings (/forum, /forum/1, etc.), since those pages aren't actually nodes.

How can I determine if a page will be a certain content type, so I can use conditional statements in page.tpl.php?

Edit: Some quick clarification. Working with $node->type is easy for pages that actually use nodes. However, when working with Views, or in the case of the forum module, the content is not node-based (it is called with forum-topic-list.tpl.php and $node is null). Because of this, it's impossible to programmatically determine if the page is really a forum (since it's not really a node). I'm trying to figure out a way around that.

Edit 2: Possible (kludgy?) solution: Putting this in theme_preprocess_page works. Is it the best way to do it though?

// Determine if page is a forum
$node = $vars['node'];
$template = $vars['template_files'][0];

if ($template == 'page-forum' || $node->type == 'forum') {
    $vars['is_forum'] = TRUE;
}


texts: How do I change the transport for remote drush alias calls

texts:
We're moving to an environment where our drupal instances will live inside docker containers managed by kubernetes.

Currently I've got scripts for things like checking module security status across large numbers of drupal sites.  Basically I maintain a file full of aliases, and I iterate over those.  It works well enough.

With the move to kubernetes, what I'd like to happen is that my aliases would somehow specify that the way to call the remote instance is via a kubectl command that effectively invokes drush in the remote container.  It looks a lot like an alternative to ssh as the transport.

Is something like this possible?
OK, so I've got the source code, and anything is presumably possible, but what might a sensible approach look like?  What should I look at to get my head around this?


texts:
I create a menu and in callback of it call this function

function floristdev_own_price_choice(){
  module_load_include('inc', 'node', 'node.pages');
  $form = node_add('customflower');
  $form['#submit'][]='floristdev_own_price_choice_sub';
      //      unset($form['#action']);
  dsm($form);
  return drupal_render($form);

}
function floristdev_own_price_choice_sub($form,$form_state){
    drupal_set_message('I called');
    dsm('blah blah');
}

but the floristdev_own_price_choice_sub never call ( I put die and drupal_set_message to test is it call )
where the problem, I am using drupal 7.


texts: how to popup a video on click to a view block title using colorbox trigger?

texts: i have created a view block to display video titles, now how to popup a video on click to the title in a block using colorbox?. path to the video folder is (default/files/default/videos).


texts: How to unset or set default radio button value programmatically?

texts:
I'm using Commerce Kickstart and I have a term reference for Size field of my product variation, and I'm using the Check boxes/radio buttons widget with commerce fancy attributes.

Currently, when I'm in the Product Display page, it seems that the default value set to Large. Since I don't want to insult my users by appearing to think that they are all "Large", I would like to set the default value to "S"

I'm using the following code to target all the commerce add to cart forms, with reference to an answer from here: Commerce - Theme Add-to-Cart form on Product Display page

function MODULENAME_form_alter(&$form, &$form_state, $form_id){
  // Add to cart form overrides
  if(substr($form_id, 0, 30) == 'commerce_cart_add_to_cart_form'){
    $form['attributes']['field_size']['#default_value'] = VALUE
    $form['unchanged_attributes']['field_size']['#value'] = '13';
    //where VALUE is chosen from $form['attributes']['field_size']['#options']
  }
}

Despite the fact that Small is highlighted as a result, when I press "Add to cart", size "L" gets added to the cart by default.

(When I click a value, such as "M", size "M" gets added to cart as expected, it is only the default value that is buggy)

This is my dpm($form) for reference.


texts:
What is the most basic valid module one can create in Drupal?

It would be useful to have a simple blueprint available, for anyone just getting started with Drupal.


texts: How do I show a link to the user registration page only to anonymous users?

texts:
I want to show anonymous users a "Register" link.

So, in mymodule.menu.yml:

mymodule.userregister:
  title: 'Register an Account'
  url: 'internal:/user/register'
  weight: 10
  menu_name: account

This adds a register link to the account menu next to the login/logout link-- great!  Except it also shows up for authenticated users, who get an "access denied" error if they click it.

I looked in user.links.menu.yml in code/modules/user to try to find something I could use:

user.page:
  title: 'My account'
  weight: -10
  route_name: user.page
  menu_name: account
user.logout:
  weight: 10
  menu_name: account
  class: Drupal\user\Plugin\Menu\LoginLogoutMenuLink

I also checked user.routing.yml:

user.register:
  path: '/user/register'
  defaults:
    _entity_form: 'user.register'
    _title: 'Create new account'
  requirements:
    _access_user_register: 'TRUE'

user.logout:
  path: '/user/logout'
  defaults:
    _controller: '\Drupal\user\Controller\UserController::logout'
  requirements:
    _user_is_logged_in: 'TRUE'

I'm stumped.  How can I make my menu link only show up for anonymous users?


texts: AJAX call, hook_menu the requested url does not exist

texts:
I want to create an AJAX request, so therefore I implement hook_menu and add this code in my .module file:

$items['aug_store_front/get-products/ajax'] = array(
  'title' => t('Get products from specific product group'),
  'page callback' => 'aug_store_get_products',
  'access arguments' => array('access content'),
);

I also add this callback function:

function aug_store_get_products($value) {
  if($_POST['id'] = 6) {
    return drupal_json_output(array('status' => 'success'));
  }
  return drupal_json_output(array('status' => 'failure'));
}

And at last, I'we added this code in a JS file:

jQuery(function($) {
  $(".view-aug-store-frontpage li a").click(function(e) {
    e.preventDefault();
    $.post('/aug_store_front/get-products/ajax', {
      id: 6,
    });
  });
});

Now when I click on the list element, the request is made but I get a 404 error.

What have I done wrong?


texts: Multiple Select Listbox Views Filter Drupal 7

texts:
I have a view with some fields in place for instance one field is a product name. I want to make a multi-select listbox that will allow for selecting 3 of them from the list of products that's a field in the view, but haven't been able to figure it out.

Thanks,

Bill


texts:
I would like to edit the registration fields, but I can't find where to do it.
I want to replace the username field on the registration form with two fields for first name and last name, which are then used to create the username as <first name> <last name>.


texts: How to replace metatag description using views argument?

texts:
I'm having trouble while trying to use views arguments for replacing metatags description.

In the view title you can easily add the view argument for example "Blog posts in category %1" so the "%1" is the first argument and it's replaced in the view title, but it does not work for metatags.

For example I want the description of the metatag to say "Blog posts about %1 in example blog"

Is there any way so that view argument works for metatags?


texts: How to disable all commerce modules from Commerce Kickstart using Drush?

texts:
I need to disable all commerce modules from the Commerce Kickstart distribution. I've done this before using the drupal backend admin/modules and have no problem at all but it took me around 4hs because of the modules dependencies.

This time I would like to do it using Drush.

How can I do this?

I tried with drush dis -y commerce but I get a lot of error/warning lines (not sure if it worths to post them here...) and get the site broken.


texts: Add a signature and date line to node print template?

texts:
I am trying to find the cleanest way to create a signature (your written signature, not forum signatures) and date line on printable pages.

I would like to do it without actually changing template files just to keep things upgradable without going back and tampering with it (it might not be me). However, if I have to I will.

Basically I need to have a "sign and date" line that shows up only when a node is being printed not when viewed on the webpage.

Something like:

By signing this you agree to our terms of service and agree to pay the minimum service charge. ETC...

Name:________________________Date:_________

(*Comments not printed)

Obviously, this doesn't need to actually show up on any webpage but only show when someone hits CTRL+P and prints the page.

Is there a module that can do this? Or is using the print module the best way to accomplish this? If it only requires a few lines of HTML/PHP, I would rather do that than add another module. I am using Display Suite...so maybe a custom view/field could work?

Thanks


texts:
I am looking for a way to show a referenced node into the primary tabs menu.

I created a content type "fact box" that is referenced to an article.
Now i like to have the content type title of the fact box node in the primary tabs menu.

I tested the Quicktabs Module and References Tabs, but they don`t use the primary tabs menu.

What`s the right way to reference a node into the primary tabs menu?


texts: How to utilise isDefaultRevision() for forward revisioning?

texts:
Since "Support revisions in different states" went into the core it is now theoretically possible to have forward revisions of nodes. For example publish revision 1 then create revision 2 but keep it unpublished. This is very useful when someone needs to create new version of a node that needs to be approved before publishing.

Sounds great so here's what I did:

I've created a node with title "Published revision". The node ID is 1 and it's revision is 1.
I've created a new revision of node 1 and changed it's title to "Unpublished revision". This node has revision 2 and it has immediately been set as default revision.
At this moment /node/1 shows the node with title "Unpublished revision".
I've used PHP to load node 1 with revision 1 and I've set it to default revision ($node->isDefaultRevision(true)).
At this moment /node/1 shows the node with title "Published revision".

So far so good. However the problem is that I'd like to edit revision 2 but I can't:

/node/1/edit shows edit form of revision 1.
/node/1/revisions/2/edit is of course 404.
And on top of that when I go to /node/1/revisions the revision 2 is listed as "Current" which of course is not true because default revision is 1. (Let's say I can live with that for now)

Questions:

How to edit arbitrary node revision?
How to control which node revision is saved as default revision?


texts: how to add field programmatically in Drupal 7 with dynamic content value?

texts:
I have a function in my e-commerce website that allow users to create own stores, i need to add dynamic field (select list) contain the stores created by the logged user when he add new product to assign this product with store.

i try to add field on the content type 'product' but i found that drupal save the values in the database.
What is he best method that resolve my problem?


texts: Configuration management export blocks from Dev to Staging

texts:
I created and placed some blocks in my local Drupal 8 Dev site. I exported the full configuration. After I import the configuration into my Staging site I get this error:

  This block is broken or missing. You may be missing content or you
  might need to enable the original module

What do I have to do? And what are best practices for exporting blocks from Dev to Staging and keep Configuration management synced and without errors?


texts: Drupal site moved from development to live - IE won't load stylesheets anymore

texts:
Before you ask ... I have looked everywhere for a solution, even drupal.org but nothing so far seems to work.

I developed a Drupal site (custom child theme for Zen) and on the development server everything looks fine in all browsers.

I did a test migration to another server before the launch. This move went well and everything looks fine in all browsers.

Then I moved the site to its live server where everything looks fine in all browsers except Internet Explorer which is not loading the stylesheets.

I know Drupal is known for generating many stylesheets and Internet Explorer will not load them if there are more than 31 (I believe) of them, but I did set the "Aggregate and compress CSS files" feature and clear the cache. This did not seem to help.

Could the answer be in one of the two following things?

The development site and backup site are both with one hosting provider. The live site is with a different hosting provider.
The development site and backup site are in subfolders of two different portfolio sites ... ie www.portfoliosite.com/Newsite.
The live site is a subdomain of the parent site ... ie www.newsite.parentsite.com.

I have run out of ideas so if anyone has a possible solution or direction to look, please let me know. Thanks


texts: Nest one content type in another to be able to add single fields

texts:
I would like to have one content type "Basic" and then another content type "Premium" that has a few extra fields than the basic one. The idea is that I want my users to pay for premium publications (using Commerce Node Checkout Module) if they want to use those extra fields. Basic content will always be free.

It is very likely that I will need to make changes to the basic content type fields that I want to also be reflected in the permium content type. Is there a way to kind of "subtheme" the content type so that it reflects the basic one whenever changes are made but still carries a few extra fields that are independend of these changes?


texts:
I want to add in my D7 installation a search field inside a special part of the page, and I don´t want to use the default search block (as it will be harder to theme, this box I have already worked on it).

Naturally, if I just type:

<form><input type="text" placeholder="Search"></form>

it won´t work.

What else does this need to actually act like the default search form in the search block? I know there´s this Custom Search module, but I think that I shouldn´t install yet another module for this simple functionality.

Thanks!!


texts:
I'm attempting to use hook_redirect_alter() as described in redirect.api.php.

I created my_module.module and entered the hook as: function my_module_redirect_alter($redirect) To test I just entered a drupal_set_message and attempted to write a notice to the log but I can't seem to get it to actually fire.

function my_module_redirect_alter($redirect) {
  $message = "redirect_alter worked!";
    \Drupal::logger('my_module')->notice($message);
}

What am I doing wrong here? Am I misunderstanding this hook?


texts: Drupal 8 Custom Composite Entity Select Field

texts:
Does anyone have an example of how I add an Entity Select (Specifically a term reference) to a custom composite?

Here's the code I've tired. The field with the title shows up but no select.

$elements['test_tax'] = [
  '#type' => 'entity_select',
  '#title' => t('Test Taxonomy'),
  '#target_type' => 'taxonomy_term',
  '#selection_handler' => 'default:taxonomy_term',
  '#selection_settings' => [
    'target_bundles' => [
      'my_terms' => 'my_terms'
    ],
    'sort' => [
      'field' => 'name',
      'direction' => 'ASC'
    ]
  ]
];

I'm a front-end guy so I'm a bit out of my element in php...


texts: User order views does not display orders for user despite permission

texts: The user order views' access permission is "View own orders of any type". I have given this permission to authenticated users yet the user sees only this message "You have not placed any orders with us yet.". What am I missing?


texts: Easy noob custom PHP question in views... Editing recent news stories view

texts:
<?php
$href = $data->node_data_field_news_external_link_field_news_external_link_value;
if($href == ''){
    $href = 'node/' . $data->nid;
    $href = url($href, array('absolute' => TRUE));
}
echo '
' . $data->node_title . ' (' . date("F j, Y", $data->node_created) . ')
';
?>

I'm sorry but I've searched for something that can help me with this.  I know it is simple, but I've already spent hours while trying to teach myself PHP in the process.  I hope that this will take someone 30 secs and allow me to keep learning.

Anyways... I have an attribute (field_successdate) in the News content type that I'm trying to use.  It's a date of when the News happened.  In the view, the customPHP field uses the node's created date and appends it to the node's title to create a link to the object.  I'm trying to replace the node's created date with my field_successdate.  I've added it to the fields and then referencing it in the customPHP code, but no luck.  Do I have to add the field_successdate to the fields in the view and then add an argument? (I've tried that too)

Can any one help?

Thanks!!!


texts: Theme takes different css file from /default/files/css when uploaded to remote server from local

texts:
I have zymphonies theme installed in my Drupal 8 website. In my localhost everything was working fine. But when I uploaded the entire files to the remote server the styling of breadcrumbs has gone (it shows as numbered list). As I inspected with the firebug the css file that is taken from default/files/css is different.

There are large number of css files in the default/files/css how does Drupal choose to select a particular css from that set of css files?


texts:
I have suddenly started getting these errors on my sign up page:

Failed to load resource: the server responded with a status of 406 (Not Acceptable) .co.uk/misc/jquery.cookie.js?v=1.0
Uncaught TypeError: Object function (j,s){return new b.fn.init(j,s)} has no method 'cookie' form.js:69

Any ideas what might be causing this...


texts:
For displaying a content, I can modify the fields order using display and field weights.

However, in a node/add/content-type page the input fields doesn't obey the weight given to the display. How can I reorder the input fields in a node/add/content-type page?


texts: Web service with application-level and user-level authentiation

texts:
I need to create a Drupal site (D6 or D7 are both OK) with an API. The Services module is the obvious choice, but I couldn't yet figure out if it is possible to do what I want.

My site will contain users and a list of mobile apps that are known to the site. Every user has an 'activity log' on the site (probably a view of nodes where type = activity and user = current user). The users can use one or more of those apps on their mobile devices. When a user does something with an app, the app should connect with the site through the API and write a message (ie. create an 'activity' node) in the user's activity log.

As far as I can see, I will need two levels of authentication. On the application level, the mobile app should identify itself as one of the known apps. On the user level, the user must log in with his username and password, to make sure that his actions will end up in the correct activity log.

I have not yet figured out the best way to do this with Services and related modules. I hope someone can tell me:

if it can be done;
which version of Services I need;
which related modules could be used for authentication;
how to configure them.

Thanks!


texts: Appending a submit handler to user_pass_submit to enable form redirect after submission

texts:
If I understand correctly, having

$form['actions']['submit']['#submit'][] = 'my_extra_submit';

in a hook_form_FORM_ID_alter would execute my_extra_submit after it executes the default handler.

However, running my code through a debugger, I see that in the array $form['actions']['submit']['#submit' there is only one element, and thats my_extra_submit. Thus after I press the Email New Password button, it only executes the code that is in my_extra_submit.

That wasn't the result I'm trying to achieve. I wanted to run the normal submit handler: user_pass_submit and then run my_extra_submit.

The reason for this is I want to redirect the user to a custom page after it finishes submission.

So use case:

user goes to /user/password
enters email
presses email new password
password is emailed
user is redirected to node/1 with a drupal_set_message("Please check your mail")

But currently whats happening is:

user goes to /user/password
enters email
presses email new password
password is NOT emailed
user is redirected.

Any help would be greatly appreciated!


texts: Displaying same username for all users with a specific role as comment author

texts:
I need to display the same username for users of a specific role as comment author.

I have a Role 'Board Moderator'. When users with this role are commenting, a uniform name 'OneUserNameForAll' should be displayed as author of a comment.

How can I get this done?


texts: I created a content type with a text field in an Omega subtheme called "Prepaid" in Drupal 7. When a user inputs a hex value, it will create a div within the content area with inline CSS that changes the background color.  I know the PHP to make this work, but I am having issues determining where to place the function, where to call the function, and how to reference the field I created in the code. I am not new to coding, but I am new to coding within Drupal.  If anyone can help, I would be eternally grateful.


texts: Drupal 7: Menu item being accessed even with false access callback?

texts:
I have a menu item:

$items['login-now'] = array
(
    'title' => 'Log In',
    'page callback' => 'some_or_other_method',
    'access callback' => 'the_permissions_function',
    'menu_name' => 'menu-ecommerce-nav',
    'type' => MENU_NORMAL_ITEM,
    'weight' => '5',
);

And then I have:

function the_permissions_function {
    $isAnonymousUser = user_is_anonymous();
    if (!$isAnonymousUser) {
        return FALSE;
    }
    return TRUE;
}

This works if I am logged out. I can see the "log in" button. But when I log in, it STILL shows this login button. Why?

What's interesting is, I added this above the "return false"

print 'xxxx'; die();

And it hits this code!! But for some reason, it still shows the menu item? Why is it not hiding the menu item?

UPDATE

Even if I just do this:

'access callback' => 'user_is_anonymous',

It STILL shows the "log in" menu item when I am LOGGED in. Why on earth is it doing this? What am I missing?


texts: Alter entity.user.canonical (/user/{uid}) route

texts:
When a user (e.g. nid = 37) goes to some other user's profile page at a url like /user/1, /user/2, ..., /user/n, I want automatically redirect them to their own: /user/37 page.

How can I do properly this with Drupal 8?

I think I must create a custom Controller Class and configure the default drupal route (/user/{uid}) adding my custom Controller, but I don't know how can I do this.


texts: List other og members from the current user group on his profile page

texts:
I am new to organic groups,  I ran into a problem, I am a member of some organic group, I need to list other members of same group on my profile page,
I am working on drupal 7 with Organic group 7.x-2.9


texts: Setup a Tabular View to Include Total Count of Nodes

texts:
Need to create a Views page displaying tabular data.

Fields I need are:

1) Total count of nodes created from Content Type A, filtered by US State, and the 2) second field is the total count of nodes created from Content Type B, filtered by US state.


texts: A website I am working on is having a WSOD problem, but only on the permissions page. I narrowed this down to the devel module, because when enable, WSOD permission page, devel module unenabled, clean permission page. Any idea what is causing this?


texts: How to manipulate a Views grid output order?

texts:
For the content region of my homepage (under Drupal 7) I have 3 columns in which I need to display 3 different content types:

Regular article teasers (only image + summary as a link to full article)
Daily quote/citation/message (article with a short citation)
Advertising node (Advertising content type article)

Visually I have to respect the orderng of this layot (aren't designers wonderful):

===Column 1======Column 2=======Column 3=

=======Article=======Article=========Quote=======
=======Article=======Article=========Article=======
=======Advert=======Article=========Article=======
=======Article=======Article=========Article=======
=======Advert=======Article=========Article=======

I made a views block, which outputs a grid of a 3 columns and 5 rows filtering only articles "Promoted to the Frontpage". So far everything ok.
Now following design decisions I'm trying to find a way to order the output of this view and particularily respect the positioning of the 2 Adverts elements, which will always be displayed in the 3rd and 5th row of the 1st Column. Same thing for the third column where the Quote element should always occupy the first postion on the 3rd column.

I'm a Views rookie so is there any Filter/Condition/etc that I'm missing and it would help me to achieve the required grid layout?

Thanks

===============================================

SOLUTIONS

After some research I found two methods to accomplish this that I'll go briefly in details in case other users come across the same needs as me.

Using Node in Block module. In the Node in Block general Settings, I created 3 blocks and assigned the content types I want to list. The great thing about this module is that it gives the option to give friendly names to the blocks themselves but also to the Fieldset labels. Very user friendly for content editors who just want to click and select on labels that have a meaning and especially for languages other than English.
In the render mode options there are a couple of options. For now, I chose the teaser but I have to check on how to further style or hack to accomplish the required look.
I gave to content editor role, the permissions to manage the Node in Blocks queue and now they've got a nice list of the nodes assigned to the block(s) during the node creation.
What I missed the first time I installed this module was that it exposes a Row Weight option. Now editors can nicely drag and drop the nodes in any order they see fit.
For further positioning and styling I installed the BlockClass module and added a class to each block to individually style/position them.
Another way to deal with this is to use Nodequeue module, create a queue list and add contents to it during node creation/modifications. Order the queue items as desired, then expose the contents of the Nodequeue list by creating a Views block with a grid output. At the moment the advantage of going through this compared to Node in Blocks, is that with Views every field can be assigned a class or the html output can be overridden, which would allow me to match 100% the required look. Since I'm not completely familiar with views and the workflow implications this will have for the editors, I'll just keep this in case the first scenario doesn't give me full styling liberty.

As always there are several ways to achieve things with Drupal, and that's what makes it exciting.

Tunox


texts: Add classes to quick tabs and nested tabs within quick tabs

texts: How can I add custom css classes to quick tabs and nested tabs within quick tabs?


texts: Check Login and display login page in views

texts:
I created a Search on my website with views exposed filters. I want only the logged in users to view the entire content. So, when the user clicks on View More.. Link I want them to be redirected to the log in page or pop up a login block.

Thanks,
Prerna


texts:
I'm using menu_get_object() to get the NID for a computed field. The problem is that on a node save, NID doesn't exist yet so the computed field produces an error. If I resave the node, everything works since now the NID exists for the computed field to refer to. How can I go about adding an IF statement that if NID doesn't exist, save the node?

$node = menu_get_object();
$assigned_uid = $node->field_agent[LANGUAGE_NONE][0]['target_id'];
$assigned_user = user_load($assigned_uid);
$percentage_split = $assigned_user->field_percentage_split[LANGUAGE_NONE][0]['value'];

$other_ins = (isset(field_get_items($entity_type, $entity, 'field_other_ins_')[0]) ? field_get_items($entity_type, $entity, 'field_other_ins_')[0]['value'] : 0);
$vb = (isset(field_get_items($entity_type, $entity, 'field_vb')[0]) ? field_get_items($entity_type, $entity, 'field_vb')[0]['value'] : 0);
$finder_s_fee = (isset(field_get_items($entity_type, $entity, 'field_finder_s_fee')[0]) ? field_get_items($entity_type, $entity, 'field_finder_s_fee')[0]['value'] : 0);
$broker_fee = (isset(field_get_items($entity_type, $entity, 'field_broker_fee')[0]) ? field_get_items($entity_type, $entity, 'field_broker_fee')[0]['value'] : 0);
$dlc_franchise_fee_hst = (isset(field_get_items($entity_type, $entity, 'field_franchise_fee_hst')[0]) ? field_get_items($entity_type, $entity, 'field_franchise_fee_hst')[0]['value'] : 0);

$value = (($other_ins + $vb + $finder_s_fee + $broker_fee) - $dlc_franchise_fee_hst ) * ($percentage_split/100);
$entity_field[0]['value'] = $value;


texts: How to use Twig expression in content fields and render?

texts:
How to use twig expression in Drupal 8 content field and render. If I embed following twig expression in field value

{% if variable == 1 %}
   you are logged in
{% endif %}

When I render the field template I want to print "you are logged in".

Right now it renders as:

{% if variable == 1 %}
  you are logged in
{% endif %}

Though views allow Twig expression. Can we achieve same in content fields?


texts: How to do views random sort for all the items in a pager?

texts:
I created five nodes:

Apple
Pear
Kiwi
Orange
Cheese

Then I created a view with the following settings:

Show content of type Fruit
Display 1 item per page, use mini pager
Sort: Global: Random

Now I flip through the nodes one at a time as an authenticated user.
There should be five nodes, but I don't see all 5 nodes in a random order; instead, I see some nodes twice, and other nodes not at all.
Things I tried

In the query settings for the view, I have tried toggling DISTINCT on/off and rebuilding the cache; it appears to have no effect.
I tried setting the views caching to time-based (1 hour), thinking that this would give me all the nodes arranged in a random order that changes each hour, but I still get some nodes twice and others not at all

Is there a way to sort the nodes in a random order and yet still go through the entire set?
Potential problems with random sorting that don't affect this use case

I am only doing this as an authenticated user; core bug affecting caching that breaks random views for anonymous users
I have caching turned off in the view


texts: Can't edit Main menu block in sidebar by clicking on "gear"

texts:
Today on one of my websites I encountered something strange. I have my "Main menu" block in my left sidebar, and when I hover over that block, the "gear" to edit it shows up, but clicking on it does nothing. Also, on pages that the block wouldn't show up on, it does (rather, the blank space does) with nothing in it, and the gear still shows up and is not clickable.

I tried moving the block out of the region, saving, refreshing, moving it back, saving, and refreshing again to see if that would fix anything, but that has not.

Any help would be greatly appreciated!

Updates:

What I mean by "nothing" is that there is the empty region with my main content area pushed over as if there actually was block content there.
And 3 errors in the console: Uncaught TypeError: Cannot read property 'msie' of undefined panels.js?ndi45m:6.... Uncaught TypeError: Cannot read property 'msie' of undefined admin_menu.js?ndi45m:223.... Failed to load resource: net::ERR_CACHE_MISS


texts: Why is langcode in configuration files ignored during installation?

texts:
I have noticed that if I install Drupal in language other than English any config that will be imported during installation will be assigned to that language no matter what language is set in the config itself (the langcode value).

This results in a strange fact that my English config is showing up as XY language and if I enable English I can translate this config only into English, which does not make sense.

So how is Drupal 8 supposed to be installed properly when it comes to i18n?

Currently I am installing in English, and in last step of installation process I add my desired language and set it as default. But that seems like odd thing to be required in order for Drupal to work "properly".


texts: How do I keep l() from escaping my link's text?

texts:
I'm using Drupal 7's l() function in my template as follows:

<h3>
  <?php print l(
    $fields['title']->content,
    'node/'.$fields['nid']->content,
    array('attributes' => array())
  ); ?>
</h3>

The problem is, this is causing apostrophes in my titles to display at &#039 instead of an apostrophe. How can I use l() properly to keep this from happening?


texts: "Class not found error" when including the file

texts:
I have a controller inside my module as follows.

<?php

/**
 * @file
 * Contains \Drupal\module_name\Controller\ControllerName.
 */
namespace Drupal\module_name\Controller;
use Drupal\Core\Controller\ControllerBase;

/**
 * NuSoap is required, and included here.
 */
    include 'nusoap/nusoap.php';
    class ControllerName extends ControllerBase {

      private static $instance = NULL;
      private $session_result, $myconnection, $namespace;
      private $debug = 0;
      private $servicestatus = false;
      private $logedin = false;
      private $appliances = array();

      /* process() retries, on error 503, $max_retries times
       * every $recursion_timeout seconds
       */
      private $max_retries = 15;
      private $recursion_timeout = 1;
      private $logfile = '';

      //constructor
      public function __construct ($ip, $user, $password) {
        $this->myconnection = new nusoap_client("https://" . $ip ."/sdk/");
        $this->myconnection->timeout = 10;
        $this->myconnection->useHTTPPersistentConnection();
        $this->myconnection->soap_defencoding = "UTF-8";
        $this->namespace = "urn:vim25";
        $status = $this->_Login($user, $password);
        if (!$status) {
          drupal_set_message(
            t(
              'Unable to connect to vCenter "@ip", check connection!',
              array('@ip' => $ip)
            ),
            'error'
          );
        }
      }
    }

and i have a folder structure inside module as nusoap/nusoap.php as follows

class nusoap_client extends nusoap_base  {

 var $username = '';                // Username for HTTP authentication
var $password = '';             // Password for HTTP authentication
var $authtype = '';             // Type of HTTP authentication
var $certRequest = array();     // Certificate for HTTP SSL authentication
var $requestHeaders = false;    // SOAP headers in request (text)
var $responseHeaders = '';      // SOAP headers from response (incomplete namespace resolution) (text)
var $responseHeader = NULL;     // SOAP Header from response (parsed)
var $document = '';             // SOAP body response portion (incomplete namespace resolution) (text)
var $endpoint;
var $forceEndpoint = '';
stuff ...

}

As you can see it is extending the base class, but whenever I run this using the router I am getting the following error:

  Class 'Drupal\module_name\Controller\nusoap_client' not found

Is it because the wrong usage of the include files in Drupal 8? How can I include files in a controller?

As a note there are more dependent files calling the nusoap inside the nusoap folder.


texts: How to create a View displaying the list of files attached to a page?

texts:
I have added a file-field to my Page content type and activated the description field. Multiple files are allowed.

I want to create a block (with Views) that displays the list of files (descriptions with links) attached to a given page.

I have tried 2 approaches:

In views I have added a relationship with files, but the description is not accessible from the list of fields provided (filename, size, extension, but no description)
Create a new display (in addition to default and Teaser ) with the Content:Files field, it displays the list nicely BUT it shows the title and I can't see any option to disable it.

If someone has an idea that would be great! Thanks a lot.


texts: I have a block that I need to show in two regions.

texts: How do I show the same block twice? I have a multiple blog site that is created using views. One half is the mens other is the womens. I created specific regions to be shown on only on specific gender--page.tpl files. I just realized I cannot show the same block twice. How will I get this to work. I am also finding that the block may have to be another view as well.


texts: Moving to new composer.json with web directory

texts:
In my Drupal 8.8.2 site, all my images were in public_html/sites/default/files. But in the new scheme of things, the sites directory is under public_html/web/sites/default/files, and every link is broken.
Is there a way to fix this en masse?


texts:
I have a form at http://turtle.umbrellamedia.net/build

What I would like is to be able to open each field set group, and close the others. For instance, if I click on "Front Color" the "Type of Phone" field set would close.

Any help would be appreciated.

Edit: I am using the forms API for this and have a custom module built that made these form items.


texts: EVA field: file entities filtered by taxonomy term of attaching node

texts:
I have a node type 'XY' with a reference to a taxonomy vocabular 'country'. Also I have a reference to this vocabular in file entities.

I have a view with an EVA display. This EVA field is attached to the node type 'XY'. This view displays file entities. These entities should be filtered by the taxonomy term of the attaching node.

When a node has the taxonomy term 'America', all file entities with taxonomy term 'America' as well should be displayed in the view (and in the node via the EVA field).

Without any filter it works with displaying all file entities.

I set a contextual filter File:

Country (field_file_image_country), Provide default value->Field value from current node/term->field_gallery_country (the taxonomy reference in node type)->TID

Specify validation criteria->Taxonomy Term->Vocabular 'Country'->Filter value type 'Term ID'

But it doesn't work. Nothing's displaying.


texts:
I am using Drupal 7. In one of my projects I used Panels to create a custom layout to one of my pages. As per the needs I also created a menu "item" with the panels. But when i access the menu path of "item" i get the menu to be displayed. When i click the home or other tabs the menu "item" disappears.

Is this a bug in panels or am I missing something that can term me as a novice?


texts: Can failure to increase new user's UID consistently by one be related to this line inside user.module file?

texts:
I have noticed at my Drupal 7 that there are gaps between the uid's of new users. The UID of a new user should increase by one from the highest assigned UID in database. However, I have noticed gaps of even a thousand.

Inside user.module file, there is the following code:

// Allow 'uid' to be set by the caller. There is no danger of writing an
      // existing user as drupal_write_record will do an INSERT.
      if (empty($account->uid)) {
        $account->uid = db_next_id(db_query('SELECT MAX(uid) FROM {users}')->fetchField());
      }

I have made the QB query read like this:

$account->uid = db_next_id(db_query('SELECT MAX(uid) FROM users')->fetchField());

It appears that this solves the issue. My question, is there really a mistake inside the core user.module file? Is it safe to modify the file the way I did? Thanks.

UPDATE:

The above does not make a difference after all. I have changed the line to this:

$account->uid = db_query('SELECT MAX(uid) FROM users')->fetchField() + 1;

This works with no reference to db_next_id. For me it is very important to increase the uid's always by one and this is one way to do it.